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

- (Base) initialize(a_hash = {})

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

- (Object) method_missing(meth, *args, &block)



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

- (Object) to_xml



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

- (Object) type



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

def type
  raise 'Error'
end