Class: Stupidedi::Values::SimpleElementVal
Abstract
Overview
This class is abstract.
This must be subclassed to add type- and version-specific
functionality. For instance, DateVal adds #day
, #month
, etc.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#element?, #size
Methods inherited from AbstractVal
#blank?, #characters, #composite?, #definition, #descriptor, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #size, #table?, #transaction_set?, #transmission?
Methods included from Color
ansi, #ansi
Methods included from Inspect
#inspect
Constructor Details
Returns a new instance of SimpleElementVal.
33
34
35
36
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 33
def initialize(usage, position)
@usage, @position =
usage, position
end
|
Instance Attribute Details
31
32
33
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 31
def position
@position
end
|
#usage ⇒ SimpleElementUse, ComponentElementUse
14
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 14
def_delegators :usage, :definition, :descriptor
|
Instance Method Details
#allowed? ⇒ Boolean
42
43
44
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 42
def allowed?
empty? or invalid? or usage.allowed_values.include?(to_s)
end
|
#component? ⇒ Boolean
71
72
73
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 71
def component?
@usage.component?
end
|
39
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 39
abstract :copy, "changes={}"
|
#date? ⇒ Boolean
50
51
52
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 50
def date?
false
end
|
#id? ⇒ Boolean
46
47
48
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 46
def id?
false
end
|
#leaf? ⇒ Boolean
67
68
69
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 67
def leaf?
true
end
|
#numeric? ⇒ Boolean
62
63
64
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 62
def numeric?
false
end
|
#simple? ⇒ Boolean
75
76
77
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 75
def simple?
not @usage.component?
end
|
#string? ⇒ Boolean
58
59
60
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 58
def string?
false
end
|
#time? ⇒ Boolean
54
55
56
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 54
def time?
false
end
|
#to_s
25
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 25
abstract :to_s
|
#to_x12 ⇒ String
19
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 19
abstract :to_x12
|
#too_long? ⇒ Boolean
21
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 21
abstract :too_long?
|
#too_short? ⇒ Boolean
23
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 23
abstract :too_short?
|
#valid? ⇒ Boolean
16
|
# File 'lib/stupidedi/values/simple_element_val.rb', line 16
abstract :valid?
|