ingreedy 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ingreedy.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  path = File.expand_path(File.join(File.dirname(__FILE__), 'ingreedy'))
2
2
 
3
- require File.join(path, 'unit_parser')
3
+ require File.join(path, 'ingreedy_parser')
4
4
 
5
5
  module Ingreedy
6
6
  class << self
7
7
  def parse(query)
8
- h = UnitParser.new(query)
9
- h.parse
10
- h
8
+ parser = IngreedyParser.new(query)
9
+ parser.parse
10
+ parser
11
11
  end
12
12
  end
13
13
  end
@@ -1,9 +1,9 @@
1
- class UnitParser
1
+ class IngreedyParser
2
2
 
3
- attr_reader :amount, :unit, :ingredient
3
+ attr_reader :amount, :unit, :ingredient, :query
4
4
 
5
5
  def initialize(query)
6
- @query = query.downcase
6
+ @query = query
7
7
  end
8
8
 
9
9
  def parse
@@ -16,7 +16,7 @@ class UnitParser
16
16
  (?<container_size> \(\g<container_amount>\s\g<container_unit>\)) {0}
17
17
  (?<unit_and_ingredient> .+ ) {0}
18
18
 
19
- (\g<amount>\s)?(\g<fraction>\s)?(\g<container_size>\s)?\g<unit_and_ingredient>
19
+ (\g<amount>\s?)?(\g<fraction>\s)?(\g<container_size>\s)?\g<unit_and_ingredient>
20
20
  }x
21
21
  results = ingreedy_regex.match(@query)
22
22
 
@@ -1,4 +1,4 @@
1
1
  module Ingreedy
2
- VERSION = '0.0.0'
2
+ VERSION = '0.0.1'
3
3
  end
4
4
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ingreedy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.0
5
+ version: 0.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ian C. Anderson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-25 00:00:00 -04:00
13
+ date: 2011-08-26 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -24,7 +24,7 @@ extensions: []
24
24
  extra_rdoc_files: []
25
25
 
26
26
  files:
27
- - lib/ingreedy/unit_parser.rb
27
+ - lib/ingreedy/ingreedy_parser.rb
28
28
  - lib/ingreedy/version.rb
29
29
  - lib/ingreedy.rb
30
30
  has_rdoc: true