Class: OReflect::Example
- Inherits:
-
Object
- Object
- OReflect::Example
- Includes:
- Accessors
- Defined in:
- lib/oreflect/example.rb
Instance Attribute Summary collapse
-
#form_values ⇒ Object
readonly
Returns the value of attribute form_values.
Instance Method Summary collapse
- #as_hash ⇒ Object
- #body(key, value) ⇒ Object
-
#initialize(&block) ⇒ Example
constructor
A new instance of Example.
Methods included from Accessors
Constructor Details
#initialize(&block) ⇒ Example
Returns a new instance of Example.
10 11 12 13 |
# File 'lib/oreflect/example.rb', line 10 def initialize(&block) @form_values = {} instance_eval(&block) if block_given? end |
Instance Attribute Details
#form_values ⇒ Object (readonly)
Returns the value of attribute form_values.
6 7 8 |
# File 'lib/oreflect/example.rb', line 6 def form_values @form_values end |
Instance Method Details
#as_hash ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/oreflect/example.rb', line 19 def as_hash h = {} h[:title] = title h[:path] = path h[:description] = description h[:response] = response h[:form_values] = form_values h end |
#body(key, value) ⇒ Object
15 16 17 |
# File 'lib/oreflect/example.rb', line 15 def body(key, value) @form_values[key] = value end |