Class: Nydp::StringAtom

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, token = nil) ⇒ StringAtom

Returns a new instance of StringAtom.



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

def initialize string, token=nil
  @string, @token = string, token
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

#tokenObject

Returns the value of attribute token.



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

def token
  @token
end

Instance Method Details

#+(other) ⇒ Object



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

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

#==(other) ⇒ Object



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

def == other
  other.to_s == self.to_s
end

#inspectObject



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

def inspect
  string.inspect
end

#nydp_typeObject



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

def nydp_type ; :string ; end

#to_sObject



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

def to_s      ;  string ; end