Class: Stupidedi::Versions::FunctionalGroups::ThirtyTen::ElementTypes::StringVal::Empty

Inherits:
Stupidedi::Versions::FunctionalGroups::ThirtyTen::ElementTypes::StringVal show all
Extended by:
Operators::Relational, Operators::Unary, Operators::Wrappers
Includes:
Comparable
Defined in:
lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb

Overview

Empty string value. Shouldn't be directly instantiated -- instead, use the empty constructor.

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::ThirtyTen::ElementTypes::StringVal

empty, #map, #string?, #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)


140
141
142
143
144
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 140

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

#copy(changes = {}) ⇒ IdentifierVal

Returns:


133
134
135
136
137
138
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 133

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

#inspectString

Returns:

  • (String)

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 155

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

#to_sString

Returns:

  • (String)

172
173
174
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 172

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)

177
178
179
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 177

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)

150
151
152
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 150

def valid?
  true
end

#value


146
147
148
# File 'lib/stupidedi/versions/functional_groups/003010/element_types/string_val.rb', line 146

def value
  ""
end