Class: Oddb2xml::Builder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Builder

Returns a new instance of Builder.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oddb2xml/builder.rb', line 39

def initialize(args = {})
  @options    = args
  @subject    = nil
  @index      = {}
  @items      = {}
  @flags      = {}
  @lppvs      = {}
  @infos      = {}
  @packs      = {}
  @migel      = {}
  @infos_zur_rose     = {} # zurrose
  @actions    = []
  @orphans    = []
  @fridges    = []
  @ean14      = false
  @companies  = []
  @people     = []
  @tag_suffix = nil
  @pharmacode = {} # index pharmacode => item
  if block_given?
    yield self
  end
end

Instance Attribute Details

#actions ⇒ Object

Returns the value of attribute actions.



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

def actions
  @actions
end

#companies ⇒ Object

Returns the value of attribute companies.



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

def companies
  @companies
end

#ean14 ⇒ Object

Returns the value of attribute ean14.



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

def ean14
  @ean14
end

#flags ⇒ Object

Returns the value of attribute flags.



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

def flags
  @flags
end

#fridges ⇒ Object

Returns the value of attribute fridges.



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

def fridges
  @fridges
end

#index ⇒ Object

Returns the value of attribute index.



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

def index
  @index
end

#infos ⇒ Object

Returns the value of attribute infos.



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

def infos
  @infos
end

#infos_zur_rose ⇒ Object

Returns the value of attribute infos_zur_rose.



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

def infos_zur_rose
  @infos_zur_rose
end

#items ⇒ Object

Returns the value of attribute items.



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

def items
  @items
end

#lppvs ⇒ Object

Returns the value of attribute lppvs.



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

def lppvs
  @lppvs
end

#migel ⇒ Object

Returns the value of attribute migel.



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

def migel
  @migel
end

#orphans ⇒ Object

Returns the value of attribute orphans.



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

def orphans
  @orphans
end

#packs ⇒ Object

Returns the value of attribute packs.



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

def packs
  @packs
end

#people ⇒ Object

Returns the value of attribute people.



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

def people
  @people
end

#subject ⇒ Object

Returns the value of attribute subject.



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

def subject
  @subject
end

#tag_suffix ⇒ Object

Returns the value of attribute tag_suffix.



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

def tag_suffix
  @tag_suffix
end

#xsd ⇒ Object

Returns the value of attribute xsd.



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

def xsd
  @xsd
end

Instance Method Details

#to_dat(subject = nil) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/oddb2xml/builder.rb', line 70

def to_dat(subject=nil)
  Oddb2xml.log  "to_dat subject #{subject ? subject.to_s :  @subject.to_s} for #{self.class}"
  if subject
    self.send('build_' + subject.to_s)
  elsif @subject
    self.send('build_' + @subject.to_s)
  end
end

#to_xml(subject = nil) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/oddb2xml/builder.rb', line 62

def to_xml(subject=nil)
  Oddb2xml.log "to_xml subject #{subject ? subject.to_s :  @subject.to_s} for #{self.class}"
  if subject
    self.send('build_' + subject.to_s)
  elsif @subject
    self.send('build_' + @subject.to_s)
  end
end