Class: Perpetuity::Postgres::DateValue
- Inherits:
-
Object
- Object
- Perpetuity::Postgres::DateValue
- Defined in:
- lib/perpetuity/postgres/date_value.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(date) ⇒ DateValue
constructor
A new instance of DateValue.
- #to_date ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(date) ⇒ DateValue
Returns a new instance of DateValue.
8 9 10 |
# File 'lib/perpetuity/postgres/date_value.rb', line 8 def initialize date @date = date end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
6 7 8 |
# File 'lib/perpetuity/postgres/date_value.rb', line 6 def date @date end |
Class Method Details
.from_sql(date_string) ⇒ Object
12 13 14 |
# File 'lib/perpetuity/postgres/date_value.rb', line 12 def self.from_sql date_string new(Date.parse(date_string)) end |
Instance Method Details
#to_date ⇒ Object
16 17 18 |
# File 'lib/perpetuity/postgres/date_value.rb', line 16 def to_date date end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/perpetuity/postgres/date_value.rb', line 20 def to_s "'#{date.to_s}'::date" end |
#value ⇒ Object
24 25 26 |
# File 'lib/perpetuity/postgres/date_value.rb', line 24 def value date end |