lib/jini.rb in jini-0.0.5 vs lib/jini.rb in jini-0.0.6

- old
+ new

@@ -94,10 +94,11 @@ end # Replace all '/' to '::' symbols # if path doesn't contain invalid symbols for selection # @return [Jini] selection + # @raise [InvalidPath] when path can't present with select def selection if @head.include?('[') || @head.include?(']') || @head.include?('@') || @head.include?('//') raise InvalidPath, 'Cannot select, path contains bad symbols' end Jini.new(@head.gsub('/', '::').to_s) @@ -126,11 +127,37 @@ ) ) end # Adds '|' to head - # @param [String] node - # @return [Jini] with '|node' on tail - def or(node) - Jini.new("#{@head}|#{node}") + # @param [String] first statement + # @param [String] second statement + # @return [Jini] with Jini '[first|second]' on tail + def or(first, second) + Jini.new("#{@head}[#{first}|#{second}]") + end + + # Less than. + # Addition '[node < value]' to tail + # @param [String] key name + # @param [Object] value + # @return [Jini] + def lt(key, value) + sat('<', key, value) + end + + # Greater than. + # Addition '[node > value]' to tail + # @param [String] key name + # @param [Object] value + # @return [Jini] + def gt(key, value) + sat('>', key, value) + end + + private + + # Some action than. + def sat(action, key, value) + Jini.new("#{@head}[#{key} #{action} #{value}]") end end