SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Ruby
Budapest - 7th June, 2012


       Papp László
     nucc @ t witter
The first met...




                                                 blog.bteam.hu
Open Academy - June 7, 2012                      twitter.com/nucc
Yukihiro Matsumoto
                                     (matz)


                                                   blog.bteam.hu
Open Academy - June 7, 2012                        twitter.com/nucc
"I wanted a scripting language that
         was more powerful than Perl, and
         more object-oriented than Python.
         That's why I decided to design my
                  own language."

                                     blog.bteam.hu
Open Academy - June 7, 2012          twitter.com/nucc
R ecipe

                              120g  Lisp
                              100g  Perl
                               130g P ython
                                   g Sm  alltalk
                               120




                                                   blog.bteam.hu
Open Academy - June 7, 2012                        twitter.com/nucc
Interpreted
                                     Dynamic typed
                         Strong in meta-programming


                                             blog.bteam.hu
Open Academy - June 7, 2012                  twitter.com/nucc
blog.bteam.hu
Open Academy - June 7, 2012   twitter.com/nucc
Ruby

                                     blog.bteam.hu
Open Academy - June 7, 2012          twitter.com/nucc
“Trying to make Ruby natural,
                      not simple”




                                       blog.bteam.hu
Open Academy - June 7, 2012            twitter.com/nucc
“Ruby is simple in appearance,
                     but is very complex inside,
                      just like our human body”


                                                  blog.bteam.hu
Open Academy - June 7, 2012                       twitter.com/nucc
People.say(“Hello OpenAcademy!”)




                                          blog.bteam.hu
Open Academy - June 7, 2012               twitter.com/nucc
People.say “Hello OpenAcademy!”




                                          blog.bteam.hu
Open Academy - June 7, 2012               twitter.com/nucc
trash << file if file.rubbish?




                                          blog.bteam.hu
Open Academy - June 7, 2012               twitter.com/nucc
trash << file unless file.referenced?




                                     blog.bteam.hu
Open Academy - June 7, 2012          twitter.com/nucc
i
                     f
      trash << file unless file.referenced?
                     o
                     t




                                     blog.bteam.hu
Open Academy - June 7, 2012          twitter.com/nucc
:Symbol




                                        blog.bteam.hu
Open Academy - June 7, 2012             twitter.com/nucc
prezi = {
                                  :title => “Ruby”,
                                  :date => “07/06/12”
                              }




                                                   blog.bteam.hu
Open Academy - June 7, 2012                        twitter.com/nucc
Academy.new     :location => “BME”




                                             blog.bteam.hu
Open Academy - June 7, 2012                  twitter.com/nucc
Academy.new({:location => “BME”})




                                          blog.bteam.hu
Open Academy - June 7, 2012               twitter.com/nucc
(1..100).select do |i|

                                  return i % 2 == 0

                          end

                          => [2, 4, 6, 8,   10,   12, 14,   16,   18,   20,   22,
                          24, 26, 28, 30,   32,   34, 36,   38,   40,   42,   44,
                          46, 48, 50, 52,   54,   56, 58,   60,   62,   64,   66,
                          68, 70, 72, 74,   76,   78, 80,   82,   84,   86,   88,
                          90, 92, 94, 96,   98,   100]


                                                                                    blog.bteam.hu
Open Academy - June 7, 2012                                                         twitter.com/nucc
(1..100).select do |i|

                                  i % 2 == 0

                          end

                          => [2, 4, 6, 8,   10,   12, 14,   16,   18,   20,   22,
                          24, 26, 28, 30,   32,   34, 36,   38,   40,   42,   44,
                          46, 48, 50, 52,   54,   56, 58,   60,   62,   64,   66,
                          68, 70, 72, 74,   76,   78, 80,   82,   84,   86,   88,
                          90, 92, 94, 96,   98,   100]


                                                                                    blog.bteam.hu
Open Academy - June 7, 2012                                                         twitter.com/nucc
(1..100).select {|i| i % 2 == 0}




                                        blog.bteam.hu
Open Academy - June 7, 2012             twitter.com/nucc
def repeat(x, &block)
              (1..x).each do |i|
                yield(i)
              end
            end




                                    blog.bteam.hu
Open Academy - June 7, 2012         twitter.com/nucc
def repeat(x, &block)
              (1..x).each do |i|
                yield(i)
              end
            end
                              repeat 10 do
                                puts “Hello Academy!”
                              end




                                                        blog.bteam.hu
Open Academy - June 7, 2012                             twitter.com/nucc
def repeat(x, &block)
              (1..x).each do |i|
                yield(i)
              end
            end
                              repeat 10 do |iteration|
                                puts “#{iteration}. Hello Academy!”
                              end




                                                         blog.bteam.hu
Open Academy - June 7, 2012                              twitter.com/nucc
blog.bteam.hu
Open Academy - June 7, 2012   twitter.com/nucc
Everything is an object!

                               Really!


                                                  blog.bteam.hu
Open Academy - June 7, 2012                       twitter.com/nucc
1


                                  blog.bteam.hu
Open Academy - June 7, 2012       twitter.com/nucc
1.even?


                              => false




                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
5.times do

                     puts “I will never use PERL!”

          end




                                              blog.bteam.hu
Open Academy - June 7, 2012                   twitter.com/nucc
1.nil?


                              => false




                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
nil




                                    blog.bteam.hu
Open Academy - June 7, 2012         twitter.com/nucc
nil.nil?


                              => true




                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
openAcademy = Class.new

                      thisAcademy = openAcademy.new




                                                blog.bteam.hu
Open Academy - June 7, 2012                     twitter.com/nucc
class OpenAcademy

             def initialize(year, month)
               @year = year
               @month = month
             end

       end




                                           blog.bteam.hu
Open Academy - June 7, 2012                twitter.com/nucc
class OpenAcademy

             attr :year

             def initialize(year, month)
               @year = year
               @month = month
             end

       end


                                           blog.bteam.hu
Open Academy - June 7, 2012                twitter.com/nucc
class OpenAcademy

             attr :year

       end
                              def year
                                @year
                              end




                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
class OpenAcademy

             attr_accessor :year

       end                    def year
                                @year
                              end

                              def year=(value)
                                @year = value
                              end




                                                 blog.bteam.hu
Open Academy - June 7, 2012                      twitter.com/nucc
class OpenAcademy

             attr_accessor :year

       end
                              academy = OpenAcademy.new(2011, 06)
                              academy.year = 2012
                              puts academy.year

                              => 2012




                                                            blog.bteam.hu
Open Academy - June 7, 2012                                 twitter.com/nucc
class OpenAcademy

             attr_accessor :year

             def year=(y)
               @year = y.to_s
             end

       end




                                   blog.bteam.hu
Open Academy - June 7, 2012        twitter.com/nucc
class OpenAcademy

             attr_accessor :year

             def year=(y)
               @year = y.to_s
             end
                              academy = OpenAcademy.new(2011, 06)
       end                    academy.year = 2012
                              puts academy.year

                              => “2012”



                                                          blog.bteam.hu
Open Academy - June 7, 2012                               twitter.com/nucc
class Academy < Conference
                      end




                                                   blog.bteam.hu
Open Academy - June 7, 2012                        twitter.com/nucc
module Comperable
                                # mixin
                              end




                                                  blog.bteam.hu
Open Academy - June 7, 2012                       twitter.com/nucc
class Academy < Conference
     include Comperable

     def <=>(o)
       myval = self.year.to_s + self.month.to_s
       other = o.year.to_s + o.month.to_s
       myval <=> other
     end
   end




                                            blog.bteam.hu
Open Academy - June 7, 2012                 twitter.com/nucc
class Academy < Conference
     include Comperable

     def <=>(o)
       myval = self.year.to_s + self.month.to_s
       other = o.year.to_s + o.month.to_s
       myval <=> other
     end
   end                 this_academy = Academy.new(2012, 6)
                              last_academy = Academy.new(2011, 10)

                              last_academy < this_academy
                              => true



                                                            blog.bteam.hu
Open Academy - June 7, 2012                                 twitter.com/nucc
blog.bteam.hu
Open Academy - June 7, 2012   twitter.com/nucc
Advanced Level




                                blog.bteam.hu
Open Academy - June 7, 2012     twitter.com/nucc
2.prim?




                                        blog.bteam.hu
Open Academy - June 7, 2012             twitter.com/nucc
class Fixnum

     def prim?
       2.upto(to_i/2).each do |i|
         return false if to_i % i == 0
       end
       to_i > 1
     end

end



                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
class Fixnum

     def prim?
       2.upto(to_i/2).each do |i|
         return false if to_i % i == 0
       end
       to_i > 1
     end             2.prim?
                              => true

end                           1.prim?
                              => false




                                         blog.bteam.hu
Open Academy - June 7, 2012              twitter.com/nucc
class << my_object
                                def prim?
                                  ...
                                end
                              end




                                                   blog.bteam.hu
Open Academy - June 7, 2012                        twitter.com/nucc
academy = Mock.new
             academy.stubs(:year).returns(2012)
             academy.stubs(:month).returns(6)




                                            blog.bteam.hu
Open Academy - June 7, 2012                 twitter.com/nucc
academy = Mock.new
             academy.stubs(:year).returns(2012)
             academy.stubs(:month).returns(6)


                              print academy.month
                              => 6

                              # Test confererence registration
                              Conferences.register academy


                                                         blog.bteam.hu
Open Academy - June 7, 2012                              twitter.com/nucc
class Xml
   def method_missing(method, *args, &block)
     print "<#{method}>"
     yield if block
     print "</#{method}>"
   end
 end
                              doc = Xml.new
                              doc.head {
                                doc.title {
                                  print “Academy
                                }
                              }

                              => <head><title>Academy</title></head>


                                                          blog.bteam.hu
Open Academy - June 7, 2012                               twitter.com/nucc
class User
      %w(name email password).each do |method|
        define_method(method) do
          @data[method.to_sym]
        end
      end
    end




                                       blog.bteam.hu
Open Academy - June 7, 2012            twitter.com/nucc
object.methods
                       object.respond_to? :method
                       alias :from, :to
                       class_eval
                       module_eval
                       Module.included(base)
                       ...



                                                    blog.bteam.hu
Open Academy - June 7, 2012                         twitter.com/nucc
Dave Thomas - Programming Ruby

                                          blog.bteam.hu
Open Academy - June 7, 2012               twitter.com/nucc
?
                              twitter.com/nucc

                                                 blog.bteam.hu
Open Academy - June 7, 2012                      twitter.com/nucc

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Open Academy - Ruby

  • 1. Ruby Budapest - 7th June, 2012 Papp László nucc @ t witter
  • 2. The first met... blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 3. Yukihiro Matsumoto (matz) blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 4. "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language." blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 5. R ecipe 120g Lisp 100g Perl 130g P ython g Sm alltalk 120 blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 6. Interpreted Dynamic typed Strong in meta-programming blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 7. blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 8. Ruby blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 9. “Trying to make Ruby natural, not simple” blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 10. “Ruby is simple in appearance, but is very complex inside, just like our human body” blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 11. People.say(“Hello OpenAcademy!”) blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 12. People.say “Hello OpenAcademy!” blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 13. trash << file if file.rubbish? blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 14. trash << file unless file.referenced? blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 15. i f trash << file unless file.referenced? o t blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 16. :Symbol blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 17. prezi = { :title => “Ruby”, :date => “07/06/12” } blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 18. Academy.new :location => “BME” blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 19. Academy.new({:location => “BME”}) blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 20. (1..100).select do |i| return i % 2 == 0 end => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100] blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 21. (1..100).select do |i| i % 2 == 0 end => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100] blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 22. (1..100).select {|i| i % 2 == 0} blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 23. def repeat(x, &block) (1..x).each do |i| yield(i) end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 24. def repeat(x, &block) (1..x).each do |i| yield(i) end end repeat 10 do puts “Hello Academy!” end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 25. def repeat(x, &block) (1..x).each do |i| yield(i) end end repeat 10 do |iteration| puts “#{iteration}. Hello Academy!” end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 26. blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 27. Everything is an object! Really! blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 28. 1 blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 29. 1.even? => false blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 30. 5.times do puts “I will never use PERL!” end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 31. 1.nil? => false blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 32. nil blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 33. nil.nil? => true blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 34. openAcademy = Class.new thisAcademy = openAcademy.new blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 35. class OpenAcademy def initialize(year, month) @year = year @month = month end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 36. class OpenAcademy attr :year def initialize(year, month) @year = year @month = month end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 37. class OpenAcademy attr :year end def year @year end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 38. class OpenAcademy attr_accessor :year end def year @year end def year=(value) @year = value end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 39. class OpenAcademy attr_accessor :year end academy = OpenAcademy.new(2011, 06) academy.year = 2012 puts academy.year => 2012 blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 40. class OpenAcademy attr_accessor :year def year=(y) @year = y.to_s end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 41. class OpenAcademy attr_accessor :year def year=(y) @year = y.to_s end academy = OpenAcademy.new(2011, 06) end academy.year = 2012 puts academy.year => “2012” blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 42. class Academy < Conference end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 43. module Comperable # mixin end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 44. class Academy < Conference include Comperable def <=>(o) myval = self.year.to_s + self.month.to_s other = o.year.to_s + o.month.to_s myval <=> other end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 45. class Academy < Conference include Comperable def <=>(o) myval = self.year.to_s + self.month.to_s other = o.year.to_s + o.month.to_s myval <=> other end end this_academy = Academy.new(2012, 6) last_academy = Academy.new(2011, 10) last_academy < this_academy => true blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 46. blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 47. Advanced Level blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 48. 2.prim? blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 49. class Fixnum def prim? 2.upto(to_i/2).each do |i| return false if to_i % i == 0 end to_i > 1 end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 50. class Fixnum def prim? 2.upto(to_i/2).each do |i| return false if to_i % i == 0 end to_i > 1 end 2.prim? => true end 1.prim? => false blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 51. class << my_object def prim? ... end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 52. academy = Mock.new academy.stubs(:year).returns(2012) academy.stubs(:month).returns(6) blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 53. academy = Mock.new academy.stubs(:year).returns(2012) academy.stubs(:month).returns(6) print academy.month => 6 # Test confererence registration Conferences.register academy blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 54. class Xml def method_missing(method, *args, &block) print "<#{method}>" yield if block print "</#{method}>" end end doc = Xml.new doc.head { doc.title { print “Academy } } => <head><title>Academy</title></head> blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 55. class User %w(name email password).each do |method| define_method(method) do @data[method.to_sym] end end end blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 56. object.methods object.respond_to? :method alias :from, :to class_eval module_eval Module.included(base) ... blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 57. Dave Thomas - Programming Ruby blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc
  • 58. ? twitter.com/nucc blog.bteam.hu Open Academy - June 7, 2012 twitter.com/nucc