module Garcon::Hookers
Public Instance Methods
define_hooker_writer(name)
click to toggle source
# File lib/garcon/utility/hookers.rb, line 53 def define_hooker_writer(name) instance_eval(*hooker_writer_args(name)) end
extract_options!(args)
click to toggle source
# File lib/garcon/utility/hookers.rb, line 67 def extract_options!(args) args.last.is_a?(Hash) ? args.pop : {} end
hooker_writer_args(name)
click to toggle source
# File lib/garcon/utility/hookers.rb, line 57 def hooker_writer_args(name) str = <<-RUBY_EVAL def #{name}(method=nil, &block) _hookers[:#{name}] << (block || method) end RUBY_EVAL [str, __FILE__, __LINE__ + 1] end
included(descendant)
click to toggle source
# File lib/garcon/utility/hookers.rb, line 71 def included(descendant) descendant.class_eval do extend Uber::InheritableAttr extend ClassMethods inheritable_attr :_hookers self._hookers = BunchOfHookers.new end end