class AutomationObject::BluePrint::HashAdapter::Screen

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

Public Instance Methods

automatic_modal_changes() click to toggle source

@return [Array<AutomaticModalChange>] array of AutomaticModalChange that are defined under the screen

# File lib/automation_object/blue_print/hash_adapter/screen.rb, line 53
def automatic_modal_changes
  return @automatic_modal_changes if defined? @automatic_modal_changes

  children = hash[:automatic_modal_changes]
  children = children.is_a?(Array) ? children : []
  @automatic_modal_changes = create_array_children(:automatic_modal_changes, children,
                                                   interface: AutomaticModalChange,
                                                   location: location + '[automatic_modal_changes]')

  @automatic_modal_changes
end
automatic_screen_changes() click to toggle source

@return [Array<Symbol>] array of screens where screen can automatically change to

# File lib/automation_object/blue_print/hash_adapter/screen.rb, line 66
def automatic_screen_changes
  screen_array = hash[:automatic_screen_changes] ||= []
  screen_array.map(&:to_sym)
end
included_views() click to toggle source

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

# File lib/automation_object/blue_print/hash_adapter/screen.rb, line 72
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/screen.rb, line 78
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