module Fiona7 # 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. class WidgetObjectIdCollector def initialize(attr_value) self.attr_value = attr_value end def call (attr_value || []).map do |widget_hash| widget_hash["destination"].try(:to_i) end.compact end protected attr_accessor :attr_value end end