Caminhos Para Vida Sustentável
em 4 módulos
março a maio de 2013
Instituto Arca Verde
São Francisco de Paula - RS
| # Downloads and installs Oracle Java 6 from here: | |
| # http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR | |
| wget \ | |
| --no-cookies \ | |
| --no-check-certificate \ | |
| --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \ | |
| http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin | |
| chmod +x jdk-6u45-linux-x64.bin | |
| ./jdk-6u45-linux-x64.bin | |
| sudo mv -T jdk1.6.0_45 /usr/lib/jvm/java-6-oracle-amd64 |
| def json | |
| if self.persisted? | |
| original_bylines_json = self.class.find(self.id).bylines.as_json | |
| else | |
| original_bylines_json = [].as_json | |
| end | |
| end | |
| # --------------- |
| class PeopleController < CrudController | |
| respond_to :js | |
| def new | |
| object = build_resource | |
| object.personable = Individual.new | |
| super | |
| end |
Caminhos Para Vida Sustentável
em 4 módulos
março a maio de 2013
Instituto Arca Verde
São Francisco de Paula - RS
| class A | |
| def do_things(b) | |
| b.c.do_things #violação de demeter | |
| end | |
| end | |
| class B | |
| attr_reader c | |
| end |
Com ou sem experiência, todo desenvolvedor sabe que o software IRÁ ser alterado em algum momento e é nessa hora que diversos problemas ocorrem.
O SOLID é um conjunto de princípios que ajudam para que essas modificações sejam menos traumáticas possíveis através de um código conciso, desacoplado e bem arquitetado.
Na palestra iremos falar sobre todos os princípios do acrônimo SOLID explicando-os e exemplificando com código Ruby.
| # Load plugins (only those I whitelist) | |
| Pry.config.should_load_plugins = false | |
| Pry.plugins["doc"].activate! | |
| # Launch Pry with access to the entire Rails stack. | |
| # If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead. | |
| # If you don't, you can load it through the lines below :) | |
| rails = File.join Dir.getwd, 'config', 'environment.rb' | |
| if File.exist?(rails) && ENV['SKIP_RAILS'].nil? |
| gem "minitest" | |
| require "minitest/spec" | |
| require "minitest/autorun" | |
| require "active_model" | |
| require "turn" | |
| require "shoulda-matchers" | |
| class MiniTest::Unit::TestCase | |
| include Shoulda::Matchers::ActiveModel | |
| extend Shoulda::Matchers::ActiveModel |
| module Tributario | |
| class RangeParser | |
| attr_reader :range_string | |
| def initialize(word) | |
| @range_string = word | |
| end | |
| # Parse the string and return an array of numbers | |
| # |
| # Create a file `spec/acceptance/support/warden.rb' with the following | |
| # contents: | |
| Spec::Runner.configure do |config| | |
| config.include Warden::Test::Helpers, :type => :acceptance | |
| config.after(:each, :type => :acceptance) { Warden.test_reset! } | |
| end | |
| # Or, if you're using RSpec 2 / Rails 3, the contents should be the following | |
| # instead: |