Module: RbPath::ObjectMixin
- Defined in:
- lib/rbpath/object_mixin.rb
Instance Method Summary collapse
- #path_values(paths) ⇒ Object
- #pquery(*query) ⇒ Object
- #query(*query) ⇒ Object
-
#rbpath_fields ⇒ Object
The object’s class may not have the ClassMixin if a singleton object was extended:.
Instance Method Details
#path_values(paths) ⇒ Object
11 12 13 |
# File 'lib/rbpath/object_mixin.rb', line 11 def path_values(paths) RbPath::Query.new(*query).values_at(self, paths) end |
#pquery(*query) ⇒ Object
7 8 9 |
# File 'lib/rbpath/object_mixin.rb', line 7 def pquery(*query) RbPath::Query.new(*query).pquery(self) end |
#query(*query) ⇒ Object
3 4 5 |
# File 'lib/rbpath/object_mixin.rb', line 3 def query(*query) RbPath::Query.new(*query).query(self) end |
#rbpath_fields ⇒ Object
The object’s class may not have the ClassMixin if a singleton object was extended:
h = { a: 1, b: 2} h.extend RbPath
21 22 23 24 |
# File 'lib/rbpath/object_mixin.rb', line 21 def rbpath_fields self.class.respond_to?(:rbpath_fields) ? self.class.rbpath_fields : nil end |