Class: CSVPlusPlus::Language::Entities::String

Inherits:
Entity
  • Object
show all
Defined in:
lib/csv_plus_plus/language/entities/string.rb

Overview

A string value

Instance Attribute Summary collapse

Attributes inherited from Entity

#id, #type

Instance Method Summary collapse

Methods inherited from Entity

#method_missing, #respond_to_missing?

Constructor Details

#initialize(value) ⇒ String

initialize



12
13
14
15
# File 'lib/csv_plus_plus/language/entities/string.rb', line 12

def initialize(value)
  super(:string)
  @value = value.gsub(/^"|"$/, '')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CSVPlusPlus::Language::Entities::Entity

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/csv_plus_plus/language/entities/string.rb', line 9

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/csv_plus_plus/language/entities/string.rb', line 23

def ==(other)
  super && value == other.value
end

#to_sObject

to_s



18
19
20
# File 'lib/csv_plus_plus/language/entities/string.rb', line 18

def to_s
  "\"#{@value}\""
end