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

Inherits:
Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal show all
Extended by:
Operators::Relational, Operators::Unary, Operators::Wrappers
Includes:
Comparable
Defined in:
lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb

Overview

Empty identifier value. Shouldn't be directly instantiated -- instead, use the empty and value constructors

Instance Attribute Summary

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods included from Operators::Relational

relational_operators

Methods included from Operators::Unary

unary_operators

Methods included from Operators::Wrappers

wrappers

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

empty, #id?, #map, #too_long?, #too_short?, value

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #date?, #id?, #initialize, #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?, #empty?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #transmission?

Methods included from Color

ansi, #ansi

Constructor Details

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

Instance Method Details

#coerce(other)


182
183
184
185
186
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 182

def coerce(other)
  # me, he = other.coerce(self)
  # me <OP> he
  return copy(:value => other.to_str), self
end

#copy(changes = {}) ⇒ IdentifierVal

Returns:


175
176
177
178
179
180
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 175

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

#inspectString

Returns:

  • (String)

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 197

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.empty#{id}")
end

#to_sString

Returns:

  • (String)

214
215
216
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 214

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)

219
220
221
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 219

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)

192
193
194
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 192

def valid?
  true
end

#value


188
189
190
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 188

def value
  ""
end