Class: AutomationObject::BluePrint::HashAdapter::View

Inherits:
Composite
  • Object
show all
Defined in:
lib/automation_object/blue_print/hash_adapter/view.rb

Overview

View composite

Instance Method Summary collapse

Instance Method Details

#automatic_modal_changesArray<AutomaticModalChange>

Returns array of AutomaticModalChange that are defined under the screen

Returns:



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/automation_object/blue_print/hash_adapter/view.rb', line 44

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_change]')

  @automatic_modal_changes
end

#automatic_screen_changesArray<Symbol>

Returns array of screens where screen can automatically change to

Returns:

  • (Array<Symbol>)

    array of screens where screen can automatically change to



57
58
59
60
# File 'lib/automation_object/blue_print/hash_adapter/view.rb', line 57

def automatic_screen_changes
  screen_array = hash[:automatic_screen_changes] ||= []
  screen_array.map(&:to_sym)
end

#included_viewsArray<Symbol>

Returns array of views this can has

Returns:

  • (Array<Symbol>)

    array of views this can has



63
64
65
66
# File 'lib/automation_object/blue_print/hash_adapter/view.rb', line 63

def included_views
  included_views_array = hash[:included_views] ||= []
  included_views_array.map(&:to_sym)
end

#merge_viewsObject

Method to take views and merge into this composite



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/automation_object/blue_print/hash_adapter/view.rb', line 69

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