Module: ArelExtensions::DateDuration
- Included in:
- Arel::Nodes::Equality, Arel::Nodes::Function, Arel::Nodes::Grouping, Attributes, Nodes::Case
- Defined in:
- lib/arel_extensions/date_duration.rb
Instance Method Summary collapse
-
#day ⇒ Object
function returns the month (as a number) given a date value.
- #format(tpl, time_zone = nil) ⇒ Object
- #format_date(tpl, time_zone = nil) ⇒ Object
- #hour ⇒ Object
- #minute ⇒ Object
-
#month ⇒ Object
function returns the month (as a number) given a date value.
- #second ⇒ Object
- #wday ⇒ Object
-
#week ⇒ Object
function returns the week (as a number) given a date value.
-
#year ⇒ Object
function returns the year (as a number) given a date value.
Instance Method Details
#day ⇒ Object
function returns the month (as a number) given a date value.
24 25 26 |
# File 'lib/arel_extensions/date_duration.rb', line 24 def day ArelExtensions::Nodes::Duration.new 'd', self end |
#format(tpl, time_zone = nil) ⇒ Object
44 45 46 |
# File 'lib/arel_extensions/date_duration.rb', line 44 def format(tpl, time_zone = nil) ArelExtensions::Nodes::Format.new [self, tpl, time_zone] end |
#format_date(tpl, time_zone = nil) ⇒ Object
48 49 50 |
# File 'lib/arel_extensions/date_duration.rb', line 48 def format_date(tpl, time_zone = nil) ArelExtensions::Nodes::FormattedDate.new [self, tpl, time_zone] end |
#hour ⇒ Object
32 33 34 |
# File 'lib/arel_extensions/date_duration.rb', line 32 def hour ArelExtensions::Nodes::Duration.new 'h', self end |
#minute ⇒ Object
36 37 38 |
# File 'lib/arel_extensions/date_duration.rb', line 36 def minute ArelExtensions::Nodes::Duration.new 'mn', self end |
#month ⇒ Object
function returns the month (as a number) given a date value.
14 15 16 |
# File 'lib/arel_extensions/date_duration.rb', line 14 def month ArelExtensions::Nodes::Duration.new 'm', self end |
#second ⇒ Object
40 41 42 |
# File 'lib/arel_extensions/date_duration.rb', line 40 def second ArelExtensions::Nodes::Duration.new 's', self end |
#wday ⇒ Object
28 29 30 |
# File 'lib/arel_extensions/date_duration.rb', line 28 def wday ArelExtensions::Nodes::Duration.new 'wd', self end |
#week ⇒ Object
function returns the week (as a number) given a date value.
19 20 21 |
# File 'lib/arel_extensions/date_duration.rb', line 19 def week ArelExtensions::Nodes::Duration.new 'w', self end |
#year ⇒ Object
function returns the year (as a number) given a date value.
9 10 11 |
# File 'lib/arel_extensions/date_duration.rb', line 9 def year ArelExtensions::Nodes::Duration.new 'y', self end |