Module: JSONSelect::Ast::PseudoSelector
- Defined in:
- lib/json_select/ast/pseudo_selector.rb
Instance Method Summary collapse
Instance Method Details
#to_ast ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/json_select/ast/pseudo_selector.rb', line 3 def to_ast if respond_to?(:e) test = { :f => a.text_value.gsub('-', '_') } test.merge!(e.to_ast) test else case a.text_value when 'first-child' { :f => :nth_child, :a => 0, :b => 1 } when 'last-child' { :f => :nth_last_child, :a => 0, :b => 1 } when 'root' { :f => :is_root } else { :f => a.text_value.gsub('-', '_') } end end end |