class AutomationObject::BluePrint::HashAdapter::Modal

Modal-level composite, ActiveRecord style composite implementation inheriting from Composite

Public Instance Methods

included_views() click to toggle source

@return [Array<Symbol>] array of views this can has

# File lib/automation_object/blue_print/hash_adapter/modal.rb, line 33
def included_views
  included_views_array = hash[:included_views] ||= []
  included_views_array.map(&:to_sym)
end
merge_views() click to toggle source

Method to take views and merge into this composite

# File lib/automation_object/blue_print/hash_adapter/modal.rb, line 39
def merge_views
  top_hash = top.hash

  return unless top_hash.is_a?(Hash)
  return unless top_hash[:views].is_a?(Hash)
  top_view_hash = top_hash[:views]

  included_views.each do |included_view|
    next unless top_view_hash[included_view].is_a?(Hash)
    self.hash = hash.deep_merge(top_view_hash[included_view])
  end
end