This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Event < ActiveRecord::Base | |
| before_save :set_event_creator | |
| def set_event_creator | |
| self.creator = Event.creator | |
| end | |
| end | |
| # Somewhere in controller ;-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| array = [:one, :two, :three] | |
| array.[] 0 #=> :one | |
| array.[] 1 #=> :two | |
| # why?;-) | |
| # array[:hello] #=> array[:hello] | |
| # [:world] #=> [:world] :'(((( | |
| # | |
| # array[:hello][:world] #=> array[:hello][:world] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| class InfoDesk | |
| def flights | |
| puts "flights" | |
| end | |
| def trains | |
| puts "trains" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Proc | |
| alias :original_call :call | |
| def call | |
| puts "custom call from proc" | |
| original_call | |
| super if defined? super | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Aquarium::Aspects::Aspect.new :around, :calls_to => /^metody_admina/, :in_type => User::AdminType do |jp, obj, *args| | |
| jp.proceed | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Object | |
| def self.define_method(*args) | |
| "fuck it" | |
| end | |
| end | |
| foo = Class.new(ExampleClass) do | |
| def bar | |
| puts "bar" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scope :example_scope, where(:invited => true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source :rubygems | |
| gem "muzang", "~> 1.0.0" | |
| gem "muzang-plugins", "~> 1.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module MethodModule | |
| def methoda(*args) | |
| return args | |
| end | |
| end | |
| class MyClass | |
| include MethodModule | |
| def methoda(*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/geokit/geocoders.rb b/lib/geokit/geocoders.rb | |
| index c407141..c9f457c 100644 | |
| --- a/lib/geokit/geocoders.rb | |
| +++ b/lib/geokit/geocoders.rb | |
| @@ -83,7 +83,7 @@ module Geokit | |
| def self.__define_accessors | |
| class_variables.each do |v| | |
| - sym = v.to_s.delete("@").to_sym | |
| + sym = v.delete("@").to_sym |