Class: Stupidedi::Versions::Common::ElementTypes::DateVal::Valid

Inherits:
Stupidedi::Versions::Common::ElementTypes::DateVal show all
Defined in:
lib/stupidedi/versions/common/element_types/dt.rb

Direct Known Subclasses

Empty, Improper, Proper

Instance Attribute Summary

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods inherited from Stupidedi::Versions::Common::ElementTypes::DateVal

#date?, empty, #proper?, #too_long?, #too_short?, value

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #date?, #id?, #initialize, #leaf?, #numeric?, #simple?, #string?, #time?, #to_s, #to_x12, #too_long?, #too_short?

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #descriptor, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #leaf?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #transmission?

Methods included from Color

ansi, #ansi

Methods included from Inspect

#inspect

Constructor Details

This class inherits a constructor from Stupidedi::Values::SimpleElementVal

Instance Method Details

#==(other)



142
143
144
145
# File 'lib/stupidedi/versions/common/element_types/dt.rb', line 142

def ==(other)
  other = DateVal.value(other, usage, position)
  other.valid? and other.value == value
end

#coerce(other)



138
139
140
# File 'lib/stupidedi/versions/common/element_types/dt.rb', line 138

def coerce(other)
  return DateVal.value(other, usage, position), self
end

#copy(changes = {}) ⇒ DateVal

Returns:



131
132
133
134
135
136
# File 'lib/stupidedi/versions/common/element_types/dt.rb', line 131

def copy(changes = {})
  DateVal.value \
    changes.fetch(:value, value),
    changes.fetch(:usage, usage),
    changes.fetch(:position, position)
end

#mapDateVal

Returns:



126
127
128
# File 'lib/stupidedi/versions/common/element_types/dt.rb', line 126

def map
  DateVal.value(yield(value), usage, position)
end

#valid?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/stupidedi/versions/common/element_types/dt.rb', line 121

def valid?
  true
end