Class: Perpetuity::Postgres::JSONStringValue
- Inherits:
-
Object
- Object
- Perpetuity::Postgres::JSONStringValue
- Defined in:
- lib/perpetuity/postgres/json_string_value.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ JSONStringValue
constructor
A new instance of JSONStringValue.
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(value) ⇒ JSONStringValue
Returns a new instance of JSONStringValue.
4 5 6 7 8 9 |
# File 'lib/perpetuity/postgres/json_string_value.rb', line 4 def initialize value @value = value .to_s .gsub('"') { '\\"' } .gsub("'") { "''" } end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/perpetuity/postgres/json_string_value.rb', line 11 def to_s %Q{"#{@value}"} end |
#to_str ⇒ Object
15 16 17 |
# File 'lib/perpetuity/postgres/json_string_value.rb', line 15 def to_str to_s end |