jgrep 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/jgrep CHANGED
@@ -31,7 +31,7 @@ begin
31
31
  end
32
32
 
33
33
  #Load json from standard in if tty is false
34
- #else find and load file from command lin arugments
34
+ #else find and load file from command line arugments
35
35
  unless STDIN.tty?
36
36
  json = STDIN.read
37
37
  else
data/jgrep.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "jgrep"
3
- s.version = "1.1.2"
3
+ s.version = "1.1.3"
4
4
 
5
5
  s.authors = ["P Loubser"]
6
- s.date = %q{2011-07-20}
6
+ s.date = %q{2011-07-27}
7
7
  s.default_executable = "jgrep"
8
8
  s.description = "Compare a list of json documents to a simple logical language and returns matches as output"
9
9
  s.email = ["ploubser@gmail.com"]
data/lib/jgrep.rb CHANGED
@@ -4,7 +4,6 @@ require 'parser/parser.rb'
4
4
  require 'parser/scanner.rb'
5
5
  require 'rubygems'
6
6
  require 'json'
7
- require 'pp'
8
7
 
9
8
  module JGrep
10
9
  @verbose = false
@@ -86,16 +85,16 @@ module JGrep
86
85
  tmp, value = format(tmp, value.gsub(/"|'/, ""))
87
86
 
88
87
  case op
89
- when "="
90
- (tmp == value) ? (return true) : (return false)
91
- when "<="
92
- (tmp <= value) ? (return true) : (return false)
93
- when ">="
94
- (tmp >= value) ? (return true) : (return false)
95
- when ">"
96
- (tmp > value) ? (return true) : (return false)
97
- when "<"
98
- (tmp < value) ? (return true) : (return false)
88
+ when "="
89
+ (tmp == value) ? (return true) : (return false)
90
+ when "<="
91
+ (tmp <= value) ? (return true) : (return false)
92
+ when ">="
93
+ (tmp >= value) ? (return true) : (return false)
94
+ when ">"
95
+ (tmp > value) ? (return true) : (return false)
96
+ when "<"
97
+ (tmp < value) ? (return true) : (return false)
99
98
  end
100
99
  end
101
100
 
@@ -111,7 +110,6 @@ module JGrep
111
110
  return false
112
111
  end
113
112
 
114
-
115
113
  #Check if complex statement (defined as [key=value...]) is
116
114
  #present over an array of key value pairs
117
115
  def self.has_complex?(document, compound)
data/lib/parser/parser.rb CHANGED
@@ -67,6 +67,11 @@ module JGrep
67
67
  parse(c_token_value, 0)
68
68
  end
69
69
 
70
+ if c_token_value =~ /!=/
71
+ c_token_value = c_token_value.gsub("!=", "=")
72
+ @execution_stack << {"not", "not"}
73
+ end
74
+
70
75
  unless n_token =~ /and|or|\)/
71
76
  unless n_token.nil?
72
77
  raise "Error at column #{scanner.token_index}. \nExpected 'and', 'or', ')'. Found '#{n_token_value}'"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 2
9
- version: 1.1.2
8
+ - 3
9
+ version: 1.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - P Loubser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-20 00:00:00 +01:00
17
+ date: 2011-07-27 00:00:00 +01:00
18
18
  default_executable: jgrep
19
19
  dependencies: []
20
20