Class: Stupidedi::Versions::FunctionalGroups::ThirtyForty::ElementTypes::DateVal::Invalid

Inherits:
Stupidedi::Versions::FunctionalGroups::ThirtyForty::ElementTypes::DateVal show all
Defined in:
lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb

Overview

Models invalid dates, either with a bad format or a date that does not exist (eg Febuary 30th 2000)

Instance Attribute Summary collapse

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods inherited from Stupidedi::Versions::FunctionalGroups::ThirtyForty::ElementTypes::DateVal

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

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #copy, #date?, #id?, #leaf?, #numeric?, #simple?, #string?, #time?

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

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

Methods included from Color

ansi, #ansi

Constructor Details

#initialize(value, usage, position) ⇒ Invalid

Returns a new instance of Invalid.


62
63
64
65
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 62

def initialize(value, usage, position)
  super(usage, position)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns:

  • (Object)

60
61
62
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 60

def value
  @value
end

Instance Method Details

#==(other)


106
107
108
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 106

def ==(other)
  eql?(other)
end

#empty?Boolean

Returns:

  • (Boolean)

71
72
73
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 71

def empty?
  false
end

#inspect


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 80

def inspect
  id = definition.bind do |d|
    "[#{"% 5s" % d.id}: #{d.name}]".bind do |s|
      if usage.forbidden?
        ansi.forbidden(s)
      elsif usage.required?
        ansi.required(s)
      else
        ansi.optional(s)
      end
    end
  end

  ansi.element("DT.invalid#{id}") << "(#{ansi.invalid(@value.inspect)})"
end

#mapDateVal

Returns:


76
77
78
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 76

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

#to_sString

Returns:

  • (String)

97
98
99
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 97

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)

102
103
104
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 102

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)

67
68
69
# File 'lib/stupidedi/versions/functional_groups/003040/element_types/date_val.rb', line 67

def valid?
  false
end