Class: DNZ::FacetArray
- Inherits:
-
Array
- Object
- Array
- DNZ::FacetArray
- Defined in:
- lib/dnz/facet_array.rb
Overview
Subclass of Array that allows retrieval by facet name
Instance Method Summary collapse
Instance Method Details
#[](value) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/dnz/facet_array.rb', line 8 def [](value) if value.is_a?(String) || value.is_a?(Symbol) self.detect{|f| f.name == value.to_s } else super end end |
#names ⇒ Object
4 5 6 |
# File 'lib/dnz/facet_array.rb', line 4 def names self.collect(&:name).uniq end |