Module: Rails::Surrender::Render::Configuration::InstanceLogic

Included in:
Rails::Surrender::Render::Configuration
Defined in:
lib/rails/surrender/render/configuration/instance_logic.rb

Instance Method Summary collapse

Instance Method Details

#exclude_locally?(key) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 43

def exclude_locally?(key)
  local_excludes.include?(key) && !local_user_includes.include?(key)
end

#locally_included_attributesObject



25
26
27
28
29
30
31
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 25

def locally_included_attributes
  [].push(resource_class.surrender_attributes)
    .push(ctrl_included_attributes)
    .push(user_included_attributes_to_render)
    .flatten.uniq
    .reject { |attr| exclude_locally?(attr) }
end

#locally_included_expandsObject



33
34
35
36
37
38
39
40
41
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 33

def locally_included_expands
  [].push(user_included_local_expansions_to_render)
    .push(ctrl_included_expansions)
    .push(resource_class.surrender_expands)
    .flatten.uniq
    .each_with_object({}) { |key, result| result[key.to_sym] = [] }
    .deep_merge(nested_user_includes)
    .deep_merge(nested_ctrl_includes)
end

#nested_ctrl_excludesObject



21
22
23
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 21

def nested_ctrl_excludes
  next_level_asks_from(ctrl_exclude)
end

#nested_ctrl_includesObject



13
14
15
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 13

def nested_ctrl_includes
  next_level_asks_from(ctrl_include)
end

#nested_user_excludesObject



17
18
19
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 17

def nested_user_excludes
  next_level_asks_from(user_exclude)
end

#nested_user_includesObject



9
10
11
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 9

def nested_user_includes
  next_level_asks_from(user_include)
end