Class: Nydp::StringAtom

Inherits:
Object show all
Defined in:
lib/nydp/string_atom.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ StringAtom

Returns a new instance of StringAtom.



5
# File 'lib/nydp/string_atom.rb', line 5

def initialize string ; @string = string ; end

Instance Attribute Details

#stringObject

Returns the value of attribute string.



3
4
5
# File 'lib/nydp/string_atom.rb', line 3

def string
  @string
end

Instance Method Details

#*(other) ⇒ Object



18
# File 'lib/nydp/string_atom.rb', line 18

def *    other ; StringAtom.new(string * other)              ; end

#+(other) ⇒ Object



20
# File 'lib/nydp/string_atom.rb', line 20

def +    other ; StringAtom.new "#{@string}#{other}"         ; end

#<(other) ⇒ Object



17
# File 'lib/nydp/string_atom.rb', line 17

def <    other ; self.string < other.string                  ; end

#<=>(other) ⇒ Object



19
# File 'lib/nydp/string_atom.rb', line 19

def <=>  other ; self < other ? -1 : (self == other ? 0 : 1) ; end

#==(other) ⇒ Object



22
23
24
# File 'lib/nydp/string_atom.rb', line 22

def == other
  other.is_a?(Nydp::StringAtom) && (other.to_s == self.to_s)
end

#>(other) ⇒ Object



16
# File 'lib/nydp/string_atom.rb', line 16

def >    other ; self.string > other.string                  ; end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


12
# File 'lib/nydp/string_atom.rb', line 12

def eql? other ; self == other                               ; end

#hashObject



14
# File 'lib/nydp/string_atom.rb', line 14

def hash       ; string.hash                                 ; end

#inspectObject



13
# File 'lib/nydp/string_atom.rb', line 13

def inspect    ; string.inspect                              ; end

#lengthObject



15
# File 'lib/nydp/string_atom.rb', line 15

def length     ; string.length                               ; end

#nydp_typeObject



7
# File 'lib/nydp/string_atom.rb', line 7

def nydp_type  ; :string                                     ; end

#to_dateObject



11
# File 'lib/nydp/string_atom.rb', line 11

def to_date    ; ::Date.parse(@string)                       ; end

#to_rubyObject



9
# File 'lib/nydp/string_atom.rb', line 9

def to_ruby    ; string                                      ; end

#to_sObject



8
# File 'lib/nydp/string_atom.rb', line 8

def to_s       ; string                                      ; end

#to_symObject



10
# File 'lib/nydp/string_atom.rb', line 10

def to_sym     ; string.to_sym                               ; end