Method: PartyProxy.dsl_method
- Defined in:
- lib/threadparty/partyproxy.rb
.dsl_method(*symbols) ⇒ Object
Allow for for an easy way to add dsl methods that are blocks.
class PartyProxyChild < PartyProxy
dsl_method :do_this
end
PartyProxyChild do
collection ["left", "right"]
do_this {|hand| puts "your #{hand} in!"}
end
46 47 48 49 50 51 52 53 |
# File 'lib/threadparty/partyproxy.rb', line 46 def self.dsl_method(*symbols) symbols.each do |symbol| instance_symbol = "@#{symbol}".to_sym define_method symbol do |&block| instance_variable_set instance_symbol, block end end end |