Class: OReflect::Example

Inherits:
Object
  • Object
show all
Includes:
Accessors
Defined in:
lib/oreflect/example.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Accessors

included

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_valuesObject (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_hashObject



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