Class: Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal::Invalid

Inherits:
Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal show all
Defined in:
lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb

Instance Attribute Summary collapse

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods inherited from Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal

empty, #id?, #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



89
90
91
92
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 89

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

Instance Attribute Details

#valueObject (readonly)

Returns:

  • (Object)


87
88
89
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 87

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 135

def ==(other)
  eql?(other) or other.nil?
end

#empty?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 98

def empty?
  false
end

#inspectString

Returns:

  • (String)


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 108

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("ID.invalid#{id}") << "(#{ansi.invalid(@value.inspect)})"
end

#mapIdentifierVal

Returns:



103
104
105
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 103

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

#to_sString

Returns:

  • (String)


125
126
127
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 125

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)


130
131
132
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 130

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 94

def valid?
  false
end