Class: Tmx::ObjectGroup

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/tmx/object_group.rb

Instance Method Summary collapse

Instance Method Details

#find(params) ⇒ Object



8
9
10
11
12
# File 'lib/tmx/object_group.rb', line 8

def find(params)
  objects.find_all do |object|
    params.any? {|key,value| object.send(key) == value }
  end.compact
end

#objectsObject



4
5
6
# File 'lib/tmx/object_group.rb', line 4

def objects
  Array(contents['objects']).map {|object| Tmx::Object.new(object.merge(contents: object)) }
end