Class: ArelExtensions::Nodes::JsonNode

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

Direct Known Subclasses

Json, JsonGet, JsonGroup, JsonMerge, JsonSet

Constant Summary collapse

RETURN_TYPE =
:json

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, #left, #return_type, #right, #type_of_attribute

Methods included from Predications

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

Instance Attribute Details

#dictObject

Returns the value of attribute dict.



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

def dict
  @dict
end

Instance Method Details

#get(key) ⇒ Object



13
14
15
# File 'lib/arel_extensions/nodes/json.rb', line 13

def get key
  JsonGet.new(self,key)
end

#group(as_array = true, orders = nil) ⇒ Object



21
22
23
# File 'lib/arel_extensions/nodes/json.rb', line 21

def group as_array = true, orders= nil
  JsonGroup.new(self,as_array, orders)
end

#hashObject



25
26
27
# File 'lib/arel_extensions/nodes/json.rb', line 25

def hash
  [@dict].hash
end

#merge(*expr) ⇒ Object



8
9
10
11
# File 'lib/arel_extensions/nodes/json.rb', line 8

def merge *expr
  args = [self] + expr.map{|e| Json.new(e)}
  JsonMerge.new(args)
end

#set(key, value) ⇒ Object



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

def set key, value
  JsonSet.new(self,key,value)
end