Class: Rokaki::FilterModel::LikeKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/rokaki/filter_model/like_keys.rb

Overview

Converts deep hashes into keys effectively drops the leaf values and make’s their keys the leaves

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ LikeKeys

Returns a new instance of LikeKeys.



10
11
12
13
14
# File 'lib/rokaki/filter_model/like_keys.rb', line 10

def initialize(args)
  @args = args
  @keys = []
  @key_paths = []
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



16
17
18
# File 'lib/rokaki/filter_model/like_keys.rb', line 16

def args
  @args
end

#key_pathsObject (readonly)

Returns the value of attribute key_paths.



16
17
18
# File 'lib/rokaki/filter_model/like_keys.rb', line 16

def key_paths
  @key_paths
end

#keysObject (readonly)

Returns the value of attribute keys.



16
17
18
# File 'lib/rokaki/filter_model/like_keys.rb', line 16

def keys
  @keys
end

Instance Method Details

#callObject



18
19
20
21
22
23
# File 'lib/rokaki/filter_model/like_keys.rb', line 18

def call
  args.keys.each do |key|
    map_keys(key: key, value: args[key])
  end
  keys
end