Class: Transmogrifier::Selector
- Inherits:
-
Object
- Object
- Transmogrifier::Selector
- Defined in:
- lib/transmogrifier/selector.rb
Constant Summary collapse
- FILTER_REGEX =
/\[(.*)\]/
- OPERATORS =
["!=", "="]
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(keys) ⇒ Selector
constructor
A new instance of Selector.
Constructor Details
#initialize(keys) ⇒ Selector
Returns a new instance of Selector.
19 20 21 |
# File 'lib/transmogrifier/selector.rb', line 19 def initialize(keys) @keys = keys end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
17 18 19 |
# File 'lib/transmogrifier/selector.rb', line 17 def keys @keys end |
Class Method Details
.from_string(string) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/transmogrifier/selector.rb', line 8 def self.from_string(string) new( string.split(".").map do |str| match = str.scan(FILTER_REGEX).flatten.first match ? match.split(",").map {|s| to_array(s)} : str end ) end |