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
- #exclude_locally?(key) ⇒ Boolean
- #locally_included_attributes ⇒ Object
- #locally_included_expands ⇒ Object
- #nested_ctrl_excludes ⇒ Object
- #nested_ctrl_includes ⇒ Object
- #nested_user_excludes ⇒ Object
- #nested_user_includes ⇒ Object
Instance Method Details
#exclude_locally?(key) ⇒ 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_attributes ⇒ Object
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_expands ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/rails/surrender/render/configuration/instance_logic.rb', line 33 def [].push(user_included_local_expansions_to_render) .push(ctrl_included_expansions) .push(resource_class.) .flatten.uniq .each_with_object({}) { |key, result| result[key.to_sym] = [] } .deep_merge(nested_user_includes) .deep_merge(nested_ctrl_includes) end |
#nested_ctrl_excludes ⇒ Object
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_includes ⇒ Object
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_excludes ⇒ Object
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_includes ⇒ Object
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 |