Class: CSVPlusPlus::Entities::String

Inherits:
Entity
  • Object
show all
Defined in:
lib/csv_plus_plus/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

Returns a new instance of String.

Parameters:

  • value (String)

    The string that has been parsed out of the template



12
13
14
15
16
# File 'lib/csv_plus_plus/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::Entities::Entity

Instance Attribute Details

#valueString (readonly)

Returns the current value of value.

Returns:

  • (String)

    the current value of value



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ boolean

Returns:

  • (boolean)


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

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

#to_sString

Returns:



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

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