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

Inherits:
Stupidedi::Versions::FunctionalGroups::TwoThousandOne::ElementTypes::FixnumVal show all
Defined in:
lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb

Overview

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

Instance Attribute Summary

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods inherited from Stupidedi::Versions::FunctionalGroups::TwoThousandOne::ElementTypes::FixnumVal

empty, #numeric?, #too_long?, #too_short?, value

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #copy, #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?, #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

#==(other) ⇒ Boolean


169
170
171
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 169

def ==(other)
  other.is_a?(Empty) or other.nil?
end

#empty?Boolean


132
133
134
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 132

def empty?
  true
end

#inspectString


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 142

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

#mapFixnumVal


137
138
139
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 137

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

#to_sString


159
160
161
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 159

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String


164
165
166
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 164

def to_x12(truncate = true)
  ""
end

#valid?Boolean


128
129
130
# File 'lib/stupidedi/versions/functional_groups/002001/element_types/fixnum_val.rb', line 128

def valid?
  true
end