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

Inherits:
Stupidedi::Versions::FunctionalGroups::TwoThousandOne::ElementTypes::StringVal show all
Extended by:
Operators::Relational, Operators::Unary, Operators::Wrappers
Includes:
Comparable
Defined in:
lib/stupidedi/versions/functional_groups/002001/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::TwoThousandOne::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)


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

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

#copy(changes = {}) ⇒ IdentifierVal

Returns:


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

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

#inspectString

Returns:

  • (String)

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

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)

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

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)

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

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)

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

def valid?
  true
end

#value


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

def value
  ""
end