Class: CSVPlusPlus::Entities::String
- Extended by:
- T::Sig
- Defined in:
- lib/csv_plus_plus/entities/string.rb
Overview
A string value
Instance Attribute Summary collapse
-
#value ⇒ String
readonly
The current value of value.
Attributes inherited from Entity
Instance Method Summary collapse
- #==(other) ⇒ T::Boolean
- #evaluate(_runtime) ⇒ ::String
-
#initialize(value) ⇒ String
constructor
A new instance of String.
Constructor Details
#initialize(value) ⇒ String
Returns a new instance of String.
17 18 19 20 21 |
# File 'lib/csv_plus_plus/entities/string.rb', line 17 def initialize(value) super(::CSVPlusPlus::Entities::Type::String) @value = ::T.let(value.gsub(/^"|"$/, ''), ::String) end |
Instance Attribute Details
#value ⇒ String (readonly)
Returns the current value of value.
9 10 11 |
# File 'lib/csv_plus_plus/entities/string.rb', line 9 def value @value end |
Instance Method Details
#==(other) ⇒ T::Boolean
35 36 37 38 39 |
# File 'lib/csv_plus_plus/entities/string.rb', line 35 def ==(other) return false unless super other.is_a?(self.class) && @value == other.value end |
#evaluate(_runtime) ⇒ ::String
27 28 29 |
# File 'lib/csv_plus_plus/entities/string.rb', line 27 def evaluate(_runtime) "\"#{@value}\"" end |