Module: Brule::RuleHelpers
- Included in:
- Rule
- Defined in:
- lib/brule.rb
Instance Method Summary collapse
- #config_reader(*symbols) ⇒ Object
- #context_accessor(*symbols) ⇒ Object
- #context_reader(*symbols) ⇒ Object
- #context_writer(*symbols) ⇒ Object
Instance Method Details
#config_reader(*symbols) ⇒ Object
24 25 26 27 28 |
# File 'lib/brule.rb', line 24 def config_reader(*symbols) symbols.each do |symbol| define_method(symbol) { config.fetch(symbol) } end end |
#context_accessor(*symbols) ⇒ Object
19 20 21 22 |
# File 'lib/brule.rb', line 19 def context_accessor(*symbols) context_reader(*symbols) context_writer(*symbols) end |
#context_reader(*symbols) ⇒ Object
7 8 9 10 11 |
# File 'lib/brule.rb', line 7 def context_reader(*symbols) symbols.each do |symbol| define_method(symbol) { context.fetch(symbol) } end end |
#context_writer(*symbols) ⇒ Object
13 14 15 16 17 |
# File 'lib/brule.rb', line 13 def context_writer(*symbols) symbols.each do |symbol| define_method("#{symbol}=") { |value| context[symbol] = value } end end |