Class: Kangaroo::RubyAdapter::Base

Inherits:
Object
  • Object
show all
Includes:
ClassDefinition, Fields
Defined in:
lib/kangaroo/ruby_adapter/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Fields

#add_fields

Methods included from ClassDefinition

#define_class

Constructor Details

#initialize(model) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/kangaroo/ruby_adapter/base.rb', line 12

def initialize model
  @oo_model = model
  @root_namespace = model.class.namespace
end

Instance Attribute Details

#oo_modelObject

Returns the value of attribute oo_model.



10
11
12
# File 'lib/kangaroo/ruby_adapter/base.rb', line 10

def oo_model
  @oo_model
end

#root_namespaceObject

Returns the value of attribute root_namespace.



10
11
12
# File 'lib/kangaroo/ruby_adapter/base.rb', line 10

def root_namespace
  @root_namespace
end

Instance Method Details

#to_rubyObject

Adapt the OpenERP model to ruby

return [Class] A Kangaroo::Model::Base subclass representing the OpenERP model



20
21
22
23
24
25
# File 'lib/kangaroo/ruby_adapter/base.rb', line 20

def to_ruby
  define_class
  add_fields

  @ruby_model
end