Module: FlexStationData::Concerns::Callable
- Defined in:
- lib/flex_station_data/concerns/callable.rb
Class Method Summary collapse
Class Method Details
.callable_modules ⇒ Object
27 28 29 |
# File 'lib/flex_station_data/concerns/callable.rb', line 27 def callable_modules @callable_modules ||= {} end |
.included(base) ⇒ Object
7 8 9 |
# File 'lib/flex_station_data/concerns/callable.rb', line 7 def included(base) base.include with(:call) end |
.with(verb) ⇒ Object Also known as: []
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/flex_station_data/concerns/callable.rb', line 11 def with(verb) callable_modules[verb.to_sym] ||= Module.new do define_singleton_method(:included) do |base| base.define_singleton_method(verb) do |*args| new(*args).public_send(verb) end base.define_singleton_method(:to_proc) do method(verb).to_proc end end end end |