Class: ArelExtensions::Nodes::JsonGroup

Inherits:
JsonNode
  • Object
show all
Defined in:
lib/arel_extensions/nodes/json.rb

Constant Summary

Constants inherited from JsonNode

ArelExtensions::Nodes::JsonNode::RETURN_TYPE

Constants inherited from Function

Function::RETURN_TYPE

Instance Attribute Summary collapse

Attributes inherited from JsonNode

#dict

Instance Method Summary collapse

Methods inherited from JsonNode

#get, #group, #hash, #merge, #set

Methods inherited from Function

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

Methods included from Predications

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

Constructor Details

#initialize(json, as_array = true, orders = nil) ⇒ JsonGroup

Returns a new instance of JsonGroup.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/arel_extensions/nodes/json.rb', line 72

def initialize json, as_array = true, orders = nil
  @dict = as_array ? json : json.dict
  @as_array = as_array
  if orders
    if orders.is_a?(Array)
      @orders = orders
    else
      @orders = [orders]
    end
  end
end

Instance Attribute Details

#as_arrayObject

Returns the value of attribute as_array.



70
71
72
# File 'lib/arel_extensions/nodes/json.rb', line 70

def as_array
  @as_array
end

#ordersObject

Returns the value of attribute orders.



70
71
72
# File 'lib/arel_extensions/nodes/json.rb', line 70

def orders
  @orders
end