Module: Tardvig::DataIdentifier
- Included in:
- HashContainer
- Defined in:
- lib/tardvig/data_identifier.rb
Overview
Mixin for containers which adds them ability to use “data identifier”: universal selector of data which contains in a container. It is useful in situation when you need to access data, but you can not directly get them (e. g. in client-server games).
Instance Method Summary collapse
-
#get_this(id) ⇒ Object
Gets an element from this container using data identifier.
Instance Method Details
#get_this(id) ⇒ Object
Gets an element from this container using data identifier.
13 14 15 16 17 18 19 |
# File 'lib/tardvig/data_identifier.rb', line 13 def get_this(id) obj = self id.to_s.split('/').each do |part| obj = get_elem_from_id obj, part end obj end |