Class: ProMashTxt

Inherits:
Brewser::Engine show all
Defined in:
lib/brewser/engines/promash_txt.rb

Defined Under Namespace

Classes: Additive, Fermentable, FermentationSchedule, FermentationStep, Hop, MashSchedule, MashStep, Recipe, Style, WaterProfile, Yeast

Class Method Summary collapse

Class Method Details

.acceptable?(q) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/brewser/engines/promash_txt.rb', line 5

def acceptable?(q)
  begin
    q.match("A ProMash Recipe Report") ? true : false
  rescue
    false
  end
end

.deserialize(string) ⇒ Object



13
14
15
16
17
# File 'lib/brewser/engines/promash_txt.rb', line 13

def deserialize(string)
  object = string.match("A ProMash Recipe Report") ? ProMashTxt::Recipe.new : ProMashTxt::Batch.new
  object.from_promash(string.split("\r\n").reject{|a|a==""})
  return object
end