Class: Coach4rb::Builder::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/coach4rb/builder.rb

Direct Known Subclasses

Entry, Partnership, Subscription, User

Instance Method Summary collapse

Constructor Details

#initialize(a_hash = {}) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/coach4rb/builder.rb', line 7

def initialize(a_hash={})
  @struct = OpenStruct.new(a_hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



17
18
19
# File 'lib/coach4rb/builder.rb', line 17

def method_missing(meth,*args,&block)
  struct.send meth, *args, &block
end

Instance Method Details

#to_xmlObject



11
12
13
14
# File 'lib/coach4rb/builder.rb', line 11

def to_xml
  a_hash = to_adjusted_hash
  Gyoku.xml(type => a_hash)
end

#typeObject



22
23
24
# File 'lib/coach4rb/builder.rb', line 22

def type
  raise 'Error'
end