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

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

Overview

Empty time 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 inherited from Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::TimeVal

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



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

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

#empty?Boolean



105
106
107
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/time_val.rb', line 105

def empty?
  true
end

#inspectString



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

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

#to_sString



127
128
129
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/time_val.rb', line 127

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String



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

def to_x12(truncate = true)
  ""
end

#valid?Boolean



101
102
103
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/time_val.rb', line 101

def valid?
  true
end