Module: TelegramOnSteroids::Configurable
- Included in:
- Keyboard, Keyboard::Button
- Defined in:
- lib/telegram_on_steroids/configurable.rb
Instance Method Summary collapse
Instance Method Details
#callable(name) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/telegram_on_steroids/configurable.rb', line 13 def callable(name) attr_writer(name) define_method(name) do var = instance_variable_get("@#{name.to_s}") var.is_a?(Proc) ? instance_eval(&var) : var end end |
#configure(&block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/telegram_on_steroids/configurable.rb', line 3 def configure(&block) define_method(:configure!) do instance_eval { block.call(self) } end define_method(:after_initialize) do configure! end end |