Module: PollEverywhere::Configurable::ClassMethods
- Defined in:
- lib/polleverywhere/configurable.rb
Instance Method Summary collapse
-
#configurable(*attrs) ⇒ Object
Setup an instance method on the target class that allows the setting of an attribute both via Class.new.attr = “fun” and Class.new.attr “fun”.
Instance Method Details
#configurable(*attrs) ⇒ Object
Setup an instance method on the target class that allows the setting of an attribute both via Class.new.attr = “fun” and Class.new.attr “fun”
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/polleverywhere/configurable.rb', line 20 def configurable(*attrs) attrs.each do |attr| class_eval %{ attr_writer :#{attr} def #{attr}(val=nil) val ? self.#{attr} = val : @#{attr} end} end end |