Slide 1

Slide 1 text

@frankyston https://frankyston.dev Ruby on Rails and its ecosystem #phpcomrapadura @frankyston

Slide 2

Slide 2 text

@frankyston https://frankyston.dev Dev @ Impulso Network Dev @ SmartFit @frankyston Frankyston Lins

Slide 3

Slide 3 text

@frankyston https://frankyston.dev Comunidade de Devs Alocação de devs/projetos https://impulso.network/ @impulsonetwork

Slide 4

Slide 4 text

@frankyston https://frankyston.dev Academias Inteligentes Treinos funcionais https://www.smartfit.com.br/ @SmartFitOficial

Slide 5

Slide 5 text

@frankyston https://frankyston.dev Ruby on Rails and its ecosystem #phpcomrapadura @frankyston

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

@frankyston https://frankyston.dev Como surgiu o ruby?

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

@frankyston https://frankyston.dev Yukihiro "Matz" Matsumoto Japão em 1993 (1995) Perl script Pyton - POO Ocidente em 1999 (1.3)

Slide 10

Slide 10 text

@frankyston https://frankyston.dev Linguagem interpretada

Slide 11

Slide 11 text

@frankyston https://frankyston.dev Em ruby, tudo é objeto

Slide 12

Slide 12 text

@frankyston https://frankyston.dev class Comida end refeicao = Comida.new refeicao.class # => Comida

Slide 13

Slide 13 text

@frankyston https://frankyston.dev “PHP”.class String < Object 1.class Fixnum < Integer

Slide 14

Slide 14 text

@frankyston https://frankyston.dev Trabalha com herança, classes, métodos, polimorfismo e escalonamento

Slide 15

Slide 15 text

@frankyston https://frankyston.dev class MyClass include Enumerable end class MyClass2 < MyClass def my_method end end class MyClass self.my_method puts "Método de classe" end end class MyClass2 < MyClass private def my_method end end

Slide 16

Slide 16 text

@frankyston https://frankyston.dev Sintaxe simples e de fácil compreensão

Slide 17

Slide 17 text

@frankyston https://frankyston.dev if i > 10 puts "maior que 10" elseif i ==10 puts " igual a10" else puts "Menor que 10" end for a in (1..6) puts a end 6.times { |t| puts t }

Slide 18

Slide 18 text

@frankyston https://frankyston.dev Tipagem dinâmica mas forte

Slide 19

Slide 19 text

@frankyston https://frankyston.dev nome = "Frankyston" idade = 31 evento = "PHP com Rapadura" peso = "Segredo :)"

Slide 20

Slide 20 text

@frankyston https://frankyston.dev sintaxe é enxuta, quase não havendo necessidade de colchetes e outros caracteres

Slide 21

Slide 21 text

@frankyston https://frankyston.dev Blocos e Lambdas

Slide 22

Slide 22 text

@frankyston https://frankyston.dev def chama_bloco yield('ola', 99) end chama_bloco {|str, num| puts str + ' ' + num.to_s} chama_bloco do |str, num| puts str + ' ' + num.to_s end

Slide 23

Slide 23 text

@frankyston https://frankyston.dev array = [1, 2, 3, 5, 6, 7, 8, 9, 10] array.each { |element| puts element } array.each_with_index do |index, element| puts "#{index} => #{element}” end

Slide 24

Slide 24 text

@frankyston https://frankyston.dev RubyGems

Slide 25

Slide 25 text

@frankyston https://frankyston.dev ruby '2.2.5' source 'https://rubygems.org' gem 'rails' gem 'pg' gem 'bootstrap-sass' gem ‘simple_form' group :production do gem 'lograge', '0.10.0' gem 'newrelic_rpm', '3.15.0.314' gem 'therubyracer', '0.12.2' end group :development, :test do gem 'pry-meta', '0.0.10' gem 'resque-mock', '0.1.1' gem 'rspec-rails', '3.4.2' gem 'rubocop', '0.50.0', require: false end

Slide 26

Slide 26 text

@frankyston https://frankyston.dev Como surgiu o rails?

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

@frankyston https://frankyston.dev David “DHH” Heinemeier Hansson EUA em 2003 (2005) Perl script Pyton - POO Ocidente em 1999 (1.3)

Slide 29

Slide 29 text

@frankyston https://frankyston.dev Framework Web quer dizer meta framework

Slide 30

Slide 30 text

@frankyston https://frankyston.dev DRY - Don’t Repeat Yourself

Slide 31

Slide 31 text

@frankyston https://frankyston.dev class User < ActiveRecord::Base def self.all_active where("state = ?", "active") end def self.all_inactive where("state = ?", "inactive") end def active? self.state == 'active' end def inactive? self.state == 'inactive' end end

Slide 32

Slide 32 text

@frankyston https://frankyston.dev class User < ActiveRecord::Base
 
 STATES = ['active', 'inactive']
 
 class <

Slide 33

Slide 33 text

@frankyston https://frankyston.dev MVC Model - View - Controller

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

@frankyston https://frankyston.dev Convention over configuration

Slide 36

Slide 36 text

@frankyston https://frankyston.dev ORM Object Relational Mapper

Slide 37

Slide 37 text

@frankyston https://frankyston.dev class Person < ActiveRecord::Base end person = Person.new person.name = "Frankyston" person.age = 20 person.save person = Person.find(1) puts person.name # Frankyston person = Person.find_by_age(30) puts person.name # Frankyston

Slide 38

Slide 38 text

@frankyston https://frankyston.dev TDD/BDD

Slide 39

Slide 39 text

@frankyston https://frankyston.dev require File.dirname(__FILE__) + '/../test_helper' class UserTest < Test::Unit::TestCase fixtures :users # Replace this with your real tests. def test_truth assert true end end

Slide 40

Slide 40 text

@frankyston https://frankyston.dev class User < ActiveRecord::Base validates :firstname, presence: true validates :lastname, presence: true validates :email, presence: true, uniqueness: true end describe User do it "é válido quando nome, último nome e email estão presentes" do user = User.new( firstname: 'Bruce', lastname: 'Dickinson', email: '[email protected]' ) expect(user).to be_valid end end

Slide 41

Slide 41 text

@frankyston https://frankyston.dev Agile (XP/Scrum)

Slide 42

Slide 42 text

@frankyston https://frankyston.dev Cases

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Legal, tem vaga pra trabalhar?

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

Pergunta?

Slide 53

Slide 53 text

@frankyston https://frankyston.dev Obrigado! #phpcomrapadura @frankyston