Class: JPath::Parser::Contains
- Inherits:
-
Object
- Object
- JPath::Parser::Contains
- Defined in:
- lib/jpath/parser/formula.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
Instance Method Summary collapse
- #boolean? ⇒ Boolean
-
#initialize(item) ⇒ Contains
constructor
A new instance of Contains.
- #to_predicate ⇒ Object
- #to_s ⇒ Object
- #true?(item, context, index, size) ⇒ Boolean
Constructor Details
#initialize(item) ⇒ Contains
Returns a new instance of Contains.
135 136 137 |
# File 'lib/jpath/parser/formula.rb', line 135 def initialize(item) @item = item end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
133 134 135 |
# File 'lib/jpath/parser/formula.rb', line 133 def item @item end |
Instance Method Details
#boolean? ⇒ Boolean
143 144 145 |
# File 'lib/jpath/parser/formula.rb', line 143 def boolean? true end |
#to_predicate ⇒ Object
147 148 149 |
# File 'lib/jpath/parser/formula.rb', line 147 def to_predicate Predicate.new(self) end |
#to_s ⇒ Object
151 152 153 |
# File 'lib/jpath/parser/formula.rb', line 151 def to_s item.to_s end |
#true?(item, context, index, size) ⇒ Boolean
139 140 141 |
# File 'lib/jpath/parser/formula.rb', line 139 def true?(item, context, index, size) item.children(context).map(&:name).include?(@item.name) end |