Class: AdfBuilder::Nodes::Vehicle
- Inherits:
-
Node
- Object
- Node
- AdfBuilder::Nodes::Vehicle
show all
- Defined in:
- lib/adf_builder/nodes/vehicle.rb
Instance Attribute Summary
Attributes inherited from Node
#attributes, #children, #tag_name, #value
Instance Method Summary
collapse
Methods inherited from Node
#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml
included, #validate!
Constructor Details
Returns a new instance of Vehicle.
10
11
12
13
14
15
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 10
def initialize
super
@tag_name = :vehicle
@attributes[:status] = :new
@attributes[:interest] = :buy
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class AdfBuilder::Nodes::Node
Instance Method Details
#colorcombination(&block) ⇒ Object
74
75
76
77
78
79
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 74
def colorcombination(&block)
cc = ColorCombination.new
cc.instance_eval(&block) if block_given?
add_child(cc)
end
|
#condition(value) ⇒ Object
26
27
28
29
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 26
def condition(value)
remove_children(:condition)
add_child(Condition.new(value))
end
|
#finance(&block) ⇒ Object
67
68
69
70
71
72
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 67
def finance(&block)
remove_children(:finance)
fin = Finance.new
fin.instance_eval(&block) if block_given?
add_child(fin)
end
|
#id(value, sequence: nil, source: nil) ⇒ Object
40
41
42
43
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 40
def id(value, sequence: nil, source: nil)
add_child(Id.new(value, sequence: sequence, source: source))
end
|
#imagetag(value, width: nil, height: nil, alttext: nil) ⇒ Object
50
51
52
53
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 50
def imagetag(value, width: nil, height: nil, alttext: nil)
remove_children(:imagetag)
add_child(ImageTag.new(value, width: width, height: height, alttext: alttext))
end
|
#interest(value) ⇒ Object
31
32
33
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 31
def interest(value)
@attributes[:interest] = value
end
|
#odometer(value, status: nil, units: nil) ⇒ Object
45
46
47
48
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 45
def odometer(value, status: nil, units: nil)
remove_children(:odometer)
add_child(Odometer.new(value, status: status, units: units))
end
|
#option(&block) ⇒ Object
60
61
62
63
64
65
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 60
def option(&block)
opt = Option.new
opt.instance_eval(&block) if block_given?
add_child(opt)
end
|
#price(value, **attrs) ⇒ Object
55
56
57
58
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 55
def price(value, **attrs)
remove_children(:price)
add_child(Price.new(value, **attrs))
end
|
#status(value) ⇒ Object
35
36
37
|
# File 'lib/adf_builder/nodes/vehicle.rb', line 35
def status(value)
@attributes[:status] = value
end
|