Module: Ingreedy

Defined in:
lib/ingreedy.rb,
lib/ingreedy/version.rb,
lib/ingreedy/dictionary.rb,
lib/ingreedy/root_parser.rb,
lib/ingreedy/rationalizer.rb,
lib/ingreedy/amount_parser.rb,
lib/ingreedy/ingreedy_parser.rb,
lib/ingreedy/dictionary_collection.rb,
lib/ingreedy/unit_variation_mapper.rb,
lib/ingreedy/case_insensitive_parser.rb

Defined Under Namespace

Modules: CaseInsensitiveParser Classes: AmountParser, Dictionary, DictionaryCollection, Parser, Rationalizer, RootParser, UnitVariationMapper

Constant Summary collapse

ParseFailed =
Class.new(StandardError)
VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.localeObject

Returns the value of attribute locale.



11
12
13
# File 'lib/ingreedy.rb', line 11

def locale
  @locale
end

.preserve_amountsObject

Returns the value of attribute preserve_amounts.



11
12
13
# File 'lib/ingreedy.rb', line 11

def preserve_amounts
  @preserve_amounts
end

Class Method Details

.dictionariesObject



21
22
23
# File 'lib/ingreedy.rb', line 21

def self.dictionaries
  @dictionaries ||= DictionaryCollection.new
end

.parse(query) ⇒ Object



14
15
16
17
18
19
# File 'lib/ingreedy.rb', line 14

def self.parse(query)
  parser = Parser.new(query)
  parser.parse
rescue Parslet::ParseFailed => e
  fail ParseFailed.new(e.message), e.backtrace
end