Class: Tmx::Objects
- Inherits:
-
Array
- Object
- Array
- Tmx::Objects
- Defined in:
- lib/tmx/objects.rb
Overview
Objects is a thin wrapper around an array of Object.
Instance Method Summary collapse
-
#find(params) ⇒ Object
Allows finding by type or a specfied hash of parameters.
Instance Method Details
#find(params) ⇒ Object
Allows finding by type or a specfied hash of parameters
20 21 22 23 24 25 26 27 28 |
# File 'lib/tmx/objects.rb', line 20 def find(params) params = { type: params } if params.is_a?(String) found_objects = find_all do |object| params.any? {|key,value| object.send(key) == value.to_s } end.compact self.class.new found_objects end |