Module: Brewser
- Defined in:
- lib/brewser.rb,
lib/brewser/brewson.rb,
lib/brewser/engines.rb,
lib/brewser/version.rb,
lib/brewser/model/hop.rb,
lib/brewser/exceptions.rb,
lib/brewser/model/base.rb,
lib/brewser/model/batch.rb,
lib/brewser/model/style.rb,
lib/brewser/model/yeast.rb,
lib/brewser/model/recipe.rb,
lib/brewser/model/additive.rb,
lib/brewser/model/mash_steps.rb,
lib/brewser/model/fermentable.rb,
lib/brewser/model/mash_schedule.rb,
lib/brewser/model/water_profile.rb,
lib/brewser/model/fermentation_steps.rb,
lib/brewser/model/fermentation_schedule.rb
Defined Under Namespace
Modules: BrewSON Classes: Additive, Batch, Engine, Error, Fermentable, FermentationSchedule, FermentationStep, Hop, ImplementationRemoved, MashSchedule, MashStep, Model, NotImplemented, Recipe, Style, WaterProfile, Yeast
Constant Summary collapse
- VERSION =
"0.2.2".freeze
Class Method Summary collapse
-
.identify(string_or_io) ⇒ Object
Returns the potential engine to process the given string.
-
.parse(string_or_io) ⇒ Object
Executes the engine matching the given string.
Class Method Details
.identify(string_or_io) ⇒ Object
Returns the potential engine to process the given string
12 13 14 15 16 17 18 19 |
# File 'lib/brewser.rb', line 12 def identify(string_or_io) return BrewSON if BrewSON.acceptable?(string_or_io) return BeerXML2 if BeerXML2.acceptable?(string_or_io) return BeerXML if BeerXML.acceptable?(string_or_io) return ProMashTxt if ProMashTxt.acceptable?(string_or_io) return ProMashRec if ProMashRec.acceptable?(string_or_io) raise Error, "unable to identify content" end |
.parse(string_or_io) ⇒ Object
Executes the engine matching the given string
22 23 24 25 26 27 28 |
# File 'lib/brewser.rb', line 22 def parse(string_or_io) if engine=self.identify(string_or_io) engine.send(:deserialize, string_or_io) else return nil end end |