SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Ruby en OSX



Thursday, September 22, 11
Para que sirve Ruby


                    • Rails



Thursday, September 22, 11
Fin


                    • Gracias!
                    • Espero que os haya gustado


Thursday, September 22, 11
Ah, pero hay mas?
                    •        Rspec / Cucumber

                    •        Sinatra

                    •        Capistrano

                    •        Capybara ( webtesting )

                    •        EventMachine

                    •        FFI

                    •        nokogiri (HTML Parsing)

                    •        mocha (Mocking)

                    •        guard (FileSystem watching DSL)

                    •        .... y muchos mas!!




Thursday, September 22, 11
¿Qué es Ruby?
                    • Lenguaje interpretado
                    • Creado por Yukihiro Matsumoto - Matz
                    • Dinamico
                    • “Reflexivo”
                    • Orientado a objetos
                    • Inspirado en Perl con un toque de Smalltalk
Thursday, September 22, 11
¿Qué es Ruby?
                    •        El lenguaje no es estandar, se guia por
                             especificaciones y por la implementación “guia”

                             • MRI
                             • JRuby
                             • Rubinius
                             • IronRuby
                             • MacRuby

Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Bloques
             a = [1,2,3,4,5,6,7,8,9,10]

             evens = a.select do |x|
               x % 2 == 0
             end
                  [2,4,6,8,10]
             doubles = a.map { |x| x + x }
                 [2,4,6,8,10,12,14,16,18,20]



Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Todo es un objeto
             4.class
             >> Fixnum
             nil.class
             >> NilClass
             Fixnum.class
             >> Class




Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Reapertura de clases
             class Fixnum
               def is_even?
                 self % 2 == 0
               end
             end

             4.is_even?
             >> true


Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Envio de mensajes, respond_to?
             4.respond_to? :is_even?
             >> true

             4.send :is_even?
             >> true

             dynamic_method = “is_even?”
             4.send dynamic_method
             >> true

Thursday, September 22, 11
¿Qué mola de Ruby?
                    • Method missing
             class WeirdString < String
               def method_missing m, *args, &block
                 self.send m.to_s.reverse
               end
             end

             t = WeirdString.new “PrUebA”
             t.esacnwod
             >> “prueba”

Thursday, September 22, 11
¿Qué mola de Ruby?

                    • procs / lambdas
                    • eval
                    • DSL
                    • mixins
                    • regexps

Thursday, September 22, 11
Ruby en OSX
                    • Preinstalado desde Leopard
                     • Version 1.8
                    • Scripting Bridge
                    • RubyCocoa => MacRuby
                    • Lenguaje soportado en applicaciones
                             del MacAppStore

Thursday, September 22, 11
Ruby en OSX

                    •        MacRuby es la evolucion de RubyCocoa

                    •        Gracias a RubyCocoa / MacRuby

                             •   TOTAL INTEROPERABILIDAD CON OBJC

                             •   Todo lo de la diapositiva 4, es interoperable con
                                 nuestras clases Objective-C

                    •        Sustituto de AppleScript gracias al Scripting Bridge



Thursday, September 22, 11
MacRuby vs RubyCocoa

                    •        MacRuby es el futuro pero,

                             •   RubyCocoa viene instalado en OSX por defecto

                             •   MacRuby tiene que ser embebido en la
                                 aplicación

                    •        RubyCocoa -> 1.8

                    •        MacRuby -> 1.9

                             •   Mejoras velocidad, Threads, GC


Thursday, September 22, 11
MacRuby vs RubyCocoa
                    •        Sintaxis
                      objc
                      [[NSWindow alloc] initWithContentRect:styleMask:backing:defer:]
                      RubyCocoa
                      NSWindow.alloc.initWithContentRect_styleMask_backing_defer (...)
                      MacRuby
                      NSWindow.alloc.initWithContentRect( ..., styleMask:..., backing:...,
                      defer...

                    •        Integración de clases en MacRuby

                             •   String, Number,... de Ruby -> NSString, NSNumber, ...

                             •   Elimina la necesidad de proxies

                    •        MacRuby compila contra LLVM -> Posibilidad de generar binarios nativos



Thursday, September 22, 11
MacRuby
                                               Objective-C
                     @interface Book

                     @property (retain, nonatomic) NSString *title

                     - (void) addBookToLibrary:(NSString*) theLibrary
                     - (void) insertPage: (Page*) thePage atPosition: (NSUInteger)
                     position

                     @end


                                                  Ruby
                     b = Book.new
                     b.title = “My new book”
                     b.addBookToLibrary “The Great Library”
                     b.insertPage myPage, :atPosition => 4
                     - OR -
                     b.insertPage myPage, atPosition: 4




Thursday, September 22, 11
MacRuby
       framework 'Cocoa'
                                                          win.title = "Hello NSCoder"
       class AppDelegate                                  win.delegate = delegate
         def windowWillClose n
           exit                                           button = NSButton.alloc.initWithFrame
         end                                              [10,10,80,50]
                                                          button.title = "Hello!"
         def hello sender                                 button.target = delegate
           puts "Hello World!"                            button.action = :hello
         end
       end                                                win.contentView.addSubview button

       delegate = AppDelegate.new                         win.display
       app = NSApplication.sharedApplication              win.orderFrontRegardless
       app.delegate = delegate                            app.run

       win = NSWindow.
                 alloc.
                 initWithContentRect [200,300,100,100],
                 :styleMask => NSTitledWindowMask
                 :backing => NSBackingStoreBuffered,
                 :defer => false




Thursday, September 22, 11
MacRuby
                    • XCode (& InterfaceBuilder) compatible




Thursday, September 22, 11
MacRuby
                    •        Aplicaciones subidas al Mac AppStore

                             •   http://www.thumperapp.com/

                             •   http://luckymac.com/ - Music Streaming

                             •   http://redwoodapp.com/ - Spotlight in the cloud




Thursday, September 22, 11
Scripting Bridge

                    •        Interfaz que puede dar un programa para facilitar la comunicación con él

                    •        Basado en Apple Events

                             •   Antes de SB, esos Apple Events se enviaban, o bien con Apple Script o
                                 con un código en Objective-C no muy sencillo

                             •   Con SB, los Apple Events se pueden enviar como un mensaje mas de
                                 Objective-C (Aparte de seguir usando AppleScript)

                                 •   Y por ello, accesible desde Ruby (RubyCocoa) o PyObjC




Thursday, September 22, 11
SB y Ruby
                    • Copiar la ruta del fichero seleccionado en
                             el Finder al clipboard

                require 'osx/cocoa'
                include OSX
                OSX.require_framework 'ScriptingBridge'

                finder = SBApplication.applicationWithBundleIdentifier_ “com.apple.finder”
                fileURL = NSURL.URLWithString_ finder.selection.get[0].URL
                system "echo #{fileURL.path} | pbcopy”




Thursday, September 22, 11
SB y Ruby
                    • Obtener las canciones de tu iTunes
                require 'osx/cocoa'
                include OSX
                OSX.require_framework 'ScriptingBridge'

                iTunes = SBApplication.applicationWithBundleIdentifier_ "com.apple.iTunes"

                iTunes.sources.each do |source|
                  puts source.name
                  source.playlists.each do |playlist|
                    puts "-- #{playlist.name}"
                    playlist.tracks.each do |track|
                      puts "t-- #{track.name}"
                    end
                  end
                end




Thursday, September 22, 11
Fin

                    • Gracias ;)



                    • Use Ruby

Thursday, September 22, 11

Mais conteúdo relacionado

Mais procurados

The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 MinutesCharles Nutter
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?Joshua Ballanco
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyistsbobmcwhirter
 
Invokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesInvokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesCharles Nutter
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBHiro Asari
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxmarekgoldmann
 
Testing Ember Apps
Testing Ember AppsTesting Ember Apps
Testing Ember Appsjo_liss
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage librarymametter
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Toolfilmprog
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projectsjazzman1980
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummiessantiagoaguiar
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSAlexandre Morgaut
 

Mais procurados (20)

The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 Minutes
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
Invokedynamic: Tales from the Trenches
Invokedynamic: Tales from the TrenchesInvokedynamic: Tales from the Trenches
Invokedynamic: Tales from the Trenches
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRB
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBox
 
Testing Ember Apps
Testing Ember AppsTesting Ember Apps
Testing Ember Apps
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
 
Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Tool
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projects
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummies
 
Vert.x
Vert.xVert.x
Vert.x
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
State of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJSState of the art: server-side javaScript - NantesJS
State of the art: server-side javaScript - NantesJS
 

Semelhante a Charla ruby nscodermad

Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyBrendan Lim
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyEvgeny Rahman
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Rubysikachu
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza trainingdavid_alphen
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Nilesh Panchal
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Thomas Lundström
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1Pavel Tyk
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby worldOrest Ivasiv
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems nhm taveer hossain khan
 

Semelhante a Charla ruby nscodermad (20)

Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
10 Things you should know about Ruby
10 Things you should know about Ruby10 Things you should know about Ruby
10 Things you should know about Ruby
 
Initiation à Ruby on Rails
Initiation à Ruby on RailsInitiation à Ruby on Rails
Initiation à Ruby on Rails
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza training
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Setup ruby
Setup rubySetup ruby
Setup ruby
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Why ruby
Why rubyWhy ruby
Why ruby
 
Week6
Week6Week6
Week6
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
cassandra
cassandracassandra
cassandra
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1
 
Adventures of java developer in ruby world
Adventures of java developer in ruby worldAdventures of java developer in ruby world
Adventures of java developer in ruby world
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems
 

Último

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Último (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Charla ruby nscodermad

  • 1. Ruby en OSX Thursday, September 22, 11
  • 2. Para que sirve Ruby • Rails Thursday, September 22, 11
  • 3. Fin • Gracias! • Espero que os haya gustado Thursday, September 22, 11
  • 4. Ah, pero hay mas? • Rspec / Cucumber • Sinatra • Capistrano • Capybara ( webtesting ) • EventMachine • FFI • nokogiri (HTML Parsing) • mocha (Mocking) • guard (FileSystem watching DSL) • .... y muchos mas!! Thursday, September 22, 11
  • 5. ¿Qué es Ruby? • Lenguaje interpretado • Creado por Yukihiro Matsumoto - Matz • Dinamico • “Reflexivo” • Orientado a objetos • Inspirado en Perl con un toque de Smalltalk Thursday, September 22, 11
  • 6. ¿Qué es Ruby? • El lenguaje no es estandar, se guia por especificaciones y por la implementación “guia” • MRI • JRuby • Rubinius • IronRuby • MacRuby Thursday, September 22, 11
  • 7. ¿Qué mola de Ruby? • Bloques a = [1,2,3,4,5,6,7,8,9,10] evens = a.select do |x| x % 2 == 0 end [2,4,6,8,10] doubles = a.map { |x| x + x } [2,4,6,8,10,12,14,16,18,20] Thursday, September 22, 11
  • 8. ¿Qué mola de Ruby? • Todo es un objeto 4.class >> Fixnum nil.class >> NilClass Fixnum.class >> Class Thursday, September 22, 11
  • 9. ¿Qué mola de Ruby? • Reapertura de clases class Fixnum def is_even? self % 2 == 0 end end 4.is_even? >> true Thursday, September 22, 11
  • 10. ¿Qué mola de Ruby? • Envio de mensajes, respond_to? 4.respond_to? :is_even? >> true 4.send :is_even? >> true dynamic_method = “is_even?” 4.send dynamic_method >> true Thursday, September 22, 11
  • 11. ¿Qué mola de Ruby? • Method missing class WeirdString < String def method_missing m, *args, &block self.send m.to_s.reverse end end t = WeirdString.new “PrUebA” t.esacnwod >> “prueba” Thursday, September 22, 11
  • 12. ¿Qué mola de Ruby? • procs / lambdas • eval • DSL • mixins • regexps Thursday, September 22, 11
  • 13. Ruby en OSX • Preinstalado desde Leopard • Version 1.8 • Scripting Bridge • RubyCocoa => MacRuby • Lenguaje soportado en applicaciones del MacAppStore Thursday, September 22, 11
  • 14. Ruby en OSX • MacRuby es la evolucion de RubyCocoa • Gracias a RubyCocoa / MacRuby • TOTAL INTEROPERABILIDAD CON OBJC • Todo lo de la diapositiva 4, es interoperable con nuestras clases Objective-C • Sustituto de AppleScript gracias al Scripting Bridge Thursday, September 22, 11
  • 15. MacRuby vs RubyCocoa • MacRuby es el futuro pero, • RubyCocoa viene instalado en OSX por defecto • MacRuby tiene que ser embebido en la aplicación • RubyCocoa -> 1.8 • MacRuby -> 1.9 • Mejoras velocidad, Threads, GC Thursday, September 22, 11
  • 16. MacRuby vs RubyCocoa • Sintaxis objc [[NSWindow alloc] initWithContentRect:styleMask:backing:defer:] RubyCocoa NSWindow.alloc.initWithContentRect_styleMask_backing_defer (...) MacRuby NSWindow.alloc.initWithContentRect( ..., styleMask:..., backing:..., defer... • Integración de clases en MacRuby • String, Number,... de Ruby -> NSString, NSNumber, ... • Elimina la necesidad de proxies • MacRuby compila contra LLVM -> Posibilidad de generar binarios nativos Thursday, September 22, 11
  • 17. MacRuby Objective-C @interface Book @property (retain, nonatomic) NSString *title - (void) addBookToLibrary:(NSString*) theLibrary - (void) insertPage: (Page*) thePage atPosition: (NSUInteger) position @end Ruby b = Book.new b.title = “My new book” b.addBookToLibrary “The Great Library” b.insertPage myPage, :atPosition => 4 - OR - b.insertPage myPage, atPosition: 4 Thursday, September 22, 11
  • 18. MacRuby framework 'Cocoa' win.title = "Hello NSCoder" class AppDelegate win.delegate = delegate def windowWillClose n exit button = NSButton.alloc.initWithFrame end [10,10,80,50] button.title = "Hello!" def hello sender button.target = delegate puts "Hello World!" button.action = :hello end end win.contentView.addSubview button delegate = AppDelegate.new win.display app = NSApplication.sharedApplication win.orderFrontRegardless app.delegate = delegate app.run win = NSWindow. alloc. initWithContentRect [200,300,100,100], :styleMask => NSTitledWindowMask :backing => NSBackingStoreBuffered, :defer => false Thursday, September 22, 11
  • 19. MacRuby • XCode (& InterfaceBuilder) compatible Thursday, September 22, 11
  • 20. MacRuby • Aplicaciones subidas al Mac AppStore • http://www.thumperapp.com/ • http://luckymac.com/ - Music Streaming • http://redwoodapp.com/ - Spotlight in the cloud Thursday, September 22, 11
  • 21. Scripting Bridge • Interfaz que puede dar un programa para facilitar la comunicación con él • Basado en Apple Events • Antes de SB, esos Apple Events se enviaban, o bien con Apple Script o con un código en Objective-C no muy sencillo • Con SB, los Apple Events se pueden enviar como un mensaje mas de Objective-C (Aparte de seguir usando AppleScript) • Y por ello, accesible desde Ruby (RubyCocoa) o PyObjC Thursday, September 22, 11
  • 22. SB y Ruby • Copiar la ruta del fichero seleccionado en el Finder al clipboard require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' finder = SBApplication.applicationWithBundleIdentifier_ “com.apple.finder” fileURL = NSURL.URLWithString_ finder.selection.get[0].URL system "echo #{fileURL.path} | pbcopy” Thursday, September 22, 11
  • 23. SB y Ruby • Obtener las canciones de tu iTunes require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' iTunes = SBApplication.applicationWithBundleIdentifier_ "com.apple.iTunes" iTunes.sources.each do |source| puts source.name source.playlists.each do |playlist| puts "-- #{playlist.name}" playlist.tracks.each do |track| puts "t-- #{track.name}" end end end Thursday, September 22, 11
  • 24. Fin • Gracias ;) • Use Ruby Thursday, September 22, 11