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 Blackbox | |
class Registry | |
module Query | |
def registry | |
@registry ||= Blackbox::Registry.new | |
end | |
def configure | |
yield registry |
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 ActiveRecord | |
class KindRollback < Rollback | |
end | |
end | |
module UpdateAttributesWithKind | |
def self.included(model_class) | |
model_class.alias_method_chain :update_attributes, :kind | |
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
require 'libxml' | |
module LibXML | |
module XML | |
module Conversions | |
module Document | |
def to_hash | |
root.to_hash | |
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
class UsersController < ResourceFull::Base | |
identified_by :username, :unless => lambda { |id| id =~ /^[0-9]+$/ } | |
queryable_with :city, :state, :from => :address | |
queryable_with :name, :columns => [:first_name, :last_name] | |
queryable_with :email_address, :fuzzy => true | |
queryable_with :is_active, :scope => :active | |
orderable_by :city, :from => :address | |
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 String | |
def to_widget | |
Widget.new self.gsub(/foo/, "bar") | |
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
irb(main):003:0> "".method(:to_widget) | |
=> #<Method: String#to_widget> | |
irb(main):003:0> "".method(:to_widget) | |
=> #<Method: String#to_widget> | |
irb(main):003:0> "".method(:to_widget) | |
=> #<Method: String(StringExtensions)#to_widget> |
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 BetterToInteger | |
def self.included(string_class) | |
string_class.alias_method_chain :to_i, :logging | |
end | |
def to_i_with_logging | |
returning(to_i_without_logging) do |new_value| | |
logger.log "Converting from #{self} to #{new_value}" | |
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
["Guybrush", "Elaine", "LeChuck"] each(name, "Hello #{name}" println) |
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
["Guybrush", "Elaine", "LeChuck"].each {|name| puts "Hello #{name}"} |
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
*** - couldn't find cell 'name' on 'Origin_0x295106F' (Condition Error NoSuchCell) |
OlderNewer