Class: ProductInterpreter

Inherits:
DslContext show all
Defined in:
lib/ProductInterpreter.rb

Instance Method Summary collapse

Methods inherited from DslContext

bubble, execute, polish_text

Instance Method Details

#coverages(*args) ⇒ Object



37
38
39
# File 'lib/ProductInterpreter.rb', line 37

def coverages(*args)
  @libtype = "coverages"
end

#endcoveragesObject



41
42
43
# File 'lib/ProductInterpreter.rb', line 41

def endcoverages
  
end

#endentitiesObject



33
34
35
# File 'lib/ProductInterpreter.rb', line 33

def endentities
  
end

#endproductObject



22
23
24
25
26
27
# File 'lib/ProductInterpreter.rb', line 22

def endproduct
  @classDef << "def self.nodeName\n"
  @classDef << "@@nodeName\n"
  @classDef << "end\n"
  @classDef << "end\n"
end

#entities(*args) ⇒ Object



29
30
31
# File 'lib/ProductInterpreter.rb', line 29

def entities(*args)
  @libtype = "entities"
end

#getResultObject



12
13
14
# File 'lib/ProductInterpreter.rb', line 12

def getResult
  @classDef+@requires
end

#has_between(*args) ⇒ Object



57
58
59
60
61
# File 'lib/ProductInterpreter.rb', line 57

def has_between(*args)
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[2]}EntityModel.rb'\n"
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[2]}NodeName.rb'\n"
  @classDef << "has_many :#{args[2]}\n"
end

#has_many(*args) ⇒ Object



51
52
53
54
55
# File 'lib/ProductInterpreter.rb', line 51

def has_many(*args)
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[0]}EntityModel.rb'\n"
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[0]}NodeName.rb'\n"
  @classDef << "has_many :#{args[0]}\n"
end

#has_one(*args) ⇒ Object



45
46
47
48
49
# File 'lib/ProductInterpreter.rb', line 45

def has_one(*args)
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[0]}EntityModel.rb'\n"
  @requires << "require '#{LIBRARY_ROOT}/#{@libtype}/#{args[0]}NodeName.rb'\n"
  @classDef << "has_one :#{args[0]}\n"
end

#product(*args) ⇒ Object



16
17
18
19
20
# File 'lib/ProductInterpreter.rb', line 16

def product(*args)
  @requires = ""
  @classDef = "class Marshaller::#{args[0]} < ActiveRecord::Base\n"
  @classDef << "@@nodeName = \"#{args[0]}\"\n"
end