Class: Qdsl::Context
- Inherits:
-
Object
- Object
- Qdsl::Context
- Defined in:
- lib/context.rb
Instance Attribute Summary collapse
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
- #add_parameter(value) ⇒ Object
- #id ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
5 6 7 8 |
# File 'lib/context.rb', line 5 def initialize @id_base = 0 @parameters = {} end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/context.rb', line 3 def parameters @parameters end |
Instance Method Details
#add_parameter(value) ⇒ Object
16 17 18 19 20 |
# File 'lib/context.rb', line 16 def add_parameter(value) parameter_id = "_param#{@parameters.size.to_s.rjust(2, '0')}" @parameters[parameter_id] = value parameter_id end |
#id ⇒ Object
10 11 12 13 14 |
# File 'lib/context.rb', line 10 def id result = "_#{@id_base.to_s.rjust(2, '0')}" @id_base += 1 result end |