Class: ArelExtensions::Nodes::Duration

Inherits:
Function
  • Object
show all
Defined in:
lib/arel_extensions/nodes/duration.rb

Constant Summary collapse

RETURN_TYPE =
:number

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Function

#!=, #==, #as, #convert_to_date_node, #convert_to_datetime_node, #convert_to_node, #convert_to_number, #convert_to_string_node, #expr, #return_type, #type_of_attribute

Methods included from Predications

#cast, #convert_to_node, #imatches, #in, #matches, #not_in, #when

Constructor Details

#initialize(left, right, aliaz = nil) ⇒ Duration

Returns a new instance of Duration.



8
9
10
11
12
13
14
# File 'lib/arel_extensions/nodes/duration.rb', line 8

def initialize left, right, aliaz = nil
  tab = Array.new
  tab << left
  tab << right
  @with_interval = left.end_with?('i')
  super(tab, aliaz)
end

Instance Attribute Details

#with_intervalObject

Returns the value of attribute with_interval.



6
7
8
# File 'lib/arel_extensions/nodes/duration.rb', line 6

def with_interval
  @with_interval
end

Instance Method Details

#leftObject



17
18
19
# File 'lib/arel_extensions/nodes/duration.rb', line 17

def left
  @expressions.first
end

#rightObject



22
23
24
# File 'lib/arel_extensions/nodes/duration.rb', line 22

def right
  @expressions[1]
end