Class: Fiona7::WidgetObjectIdCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/fiona7/widget_object_id_collector.rb

Overview

Extracts widget object IDs from a widgetlist attribute read from Fiona7::WriteObj#attr_values[]

The array contains integer IDs of the objects representing the widgets within given attr_value. For nil values it returns an empty array.

Instance Method Summary collapse

Constructor Details

#initialize(attr_value) ⇒ WidgetObjectIdCollector

Returns a new instance of WidgetObjectIdCollector.



9
10
11
# File 'lib/fiona7/widget_object_id_collector.rb', line 9

def initialize(attr_value)
  self.attr_value = attr_value
end

Instance Method Details

#callObject



13
14
15
16
17
# File 'lib/fiona7/widget_object_id_collector.rb', line 13

def call
  (attr_value || []).map do |widget_hash|
    widget_hash["destination"].try(:to_i)
  end.compact
end