Class: JPath::Parser::Contains

Inherits:
Object
  • Object
show all
Defined in:
lib/jpath/parser/formula.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#itemObject (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

Returns:

  • (Boolean)


143
144
145
# File 'lib/jpath/parser/formula.rb', line 143

def boolean?
  true
end

#to_predicateObject



147
148
149
# File 'lib/jpath/parser/formula.rb', line 147

def to_predicate
  Predicate.new(self)
end

#to_sObject



151
152
153
# File 'lib/jpath/parser/formula.rb', line 151

def to_s
  item.to_s
end

#true?(item, context, index, size) ⇒ Boolean

Returns:

  • (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