Class: Onuro::ContextBuilder
- Inherits:
-
Object
- Object
- Onuro::ContextBuilder
- Defined in:
- lib/onuro/context_builder.rb
Overview
Builder class that allows to create a builder pattern for easily creation of the Onuro::Context containing attributes to help you in the event rule processing
Instance Attribute Summary collapse
-
#context ⇒ Object
Onuro::Context generated by the Onuro::ContextBuilder.
Class Method Summary collapse
-
.build {|builder| ... } ⇒ Object
Class method that uses the builder pattern in order to easy create an Onuro::Context instance and being populated.
Instance Method Summary collapse
-
#add(key, value) ⇒ Object
Adds a key/value item in the Onuro::Context.
-
#initialize ⇒ ContextBuilder
constructor
Creates a new instance of Onuro::ContextBuilder with its Onuro::Context attribute set to default values.
Constructor Details
#initialize ⇒ ContextBuilder
Creates a new instance of Onuro::ContextBuilder with its Onuro::Context attribute set to default values.
15 16 17 |
# File 'lib/onuro/context_builder.rb', line 15 def initialize self.context = Context.new end |
Instance Attribute Details
#context ⇒ Object
Onuro::Context generated by the Onuro::ContextBuilder
9 10 11 |
# File 'lib/onuro/context_builder.rb', line 9 def context @context end |
Class Method Details
.build {|builder| ... } ⇒ Object
Class method that uses the builder pattern in order to easy create an Onuro::Context instance and being populated
38 39 40 41 42 |
# File 'lib/onuro/context_builder.rb', line 38 def self.build builder = new yield builder if block_given? builder.context end |
Instance Method Details
#add(key, value) ⇒ Object
Adds a key/value item in the Onuro::Context
25 26 27 |
# File 'lib/onuro/context_builder.rb', line 25 def add(key, value) context.add(key, value) end |