Class: Quickbooks::Type
Direct Known Subclasses
Quickbooks::Types::AMTTYPE, Quickbooks::Types::BOOLTYPE, Quickbooks::Types::DATETIMETYPE, Quickbooks::Types::DATETYPE, Quickbooks::Types::ENUMTYPE, Quickbooks::Types::FLOATTYPE, Quickbooks::Types::GUIDTYPE, Quickbooks::Types::IDTYPE, Quickbooks::Types::INTTYPE, Quickbooks::Types::PERCENTTYPE, Quickbooks::Types::PRICETYPE, Quickbooks::Types::QUANTYPE, Quickbooks::Types::STRTYPE, Quickbooks::Types::TIMEINTERVALTYPE
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value = nil) ⇒ Type
Returns a new instance of Type.
19
20
21
22
23
|
# File 'lib/quickbooks/type.rb', line 19
def initialize(value=nil)
raise RuntimeError, "Type class '#{self.class.short_name}' has no native class set. This is a BUG. Please report it!" unless self.class.native.is_a?(Module)
self.value = value
clean!
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
69
70
71
72
73
|
# File 'lib/quickbooks/type.rb', line 69
def method_missing(method_name, *args, &block)
block_given? ?
@value.method(method_name).call(*args) {|*arr| yield *arr } :
@value.method(method_name).call(*args)
end
|
Instance Attribute Details
#value ⇒ Object
Also known as:
__value__
Returns the value of attribute value.
13
14
15
|
# File 'lib/quickbooks/type.rb', line 13
def value
@value
end
|
Class Method Details
.native(type = nil) ⇒ Object
5
6
7
8
|
# File 'lib/quickbooks/type.rb', line 5
def native(type=nil)
@native = type if type
@native
end
|
Instance Method Details
38
39
40
|
# File 'lib/quickbooks/type.rb', line 38
def dirty?
@dirty || @value != @original_value
end
|
#eql?(value) ⇒ Boolean
Also known as:
===
25
26
27
|
# File 'lib/quickbooks/type.rb', line 25
def eql?(value)
@value.eql?(value)
end
|
46
47
48
|
# File 'lib/quickbooks/type.rb', line 46
def inspect
$DEBUG ? super : @value.inspect
end
|
30
31
32
|
# File 'lib/quickbooks/type.rb', line 30
def nil?
@value.nil?
end
|
34
35
36
|
# File 'lib/quickbooks/type.rb', line 34
def to_s
@value.to_s
end
|
50
51
52
|
# File 'lib/quickbooks/type.rb', line 50
def to_xml
@value.to_s.xml_escaped
end
|
42
43
44
|
# File 'lib/quickbooks/type.rb', line 42
def valid?
raise "Not Implemented Yet! (Type Validation)"
end
|