Class: BeerRecipe::TextFormatter

Inherits:
RecipeFormatter show all
Defined in:
lib/beer_recipe/text_formatter.rb

Instance Method Summary collapse

Methods inherited from RecipeFormatter

#format, #format_records, #initialize, #output, #parse, #template, #template_file, #template_path

Constructor Details

This class inherits a constructor from BeerRecipe::RecipeFormatter

Instance Method Details

#before_fermentablesObject



25
26
27
# File 'lib/beer_recipe/text_formatter.rb', line 25

def before_fermentables
  puts "\nFermentables:"
end

#before_hopsObject



33
34
35
# File 'lib/beer_recipe/text_formatter.rb', line 33

def before_hops
  puts "\nHops:"
end

#before_miscsObject



41
42
43
# File 'lib/beer_recipe/text_formatter.rb', line 41

def before_miscs
  puts "\nMiscellaneous:"
end

#before_yeastsObject



49
50
51
# File 'lib/beer_recipe/text_formatter.rb', line 49

def before_yeasts
  puts "\nYeasts:"
end

#format_fermentable(f) ⇒ Object



29
30
31
# File 'lib/beer_recipe/text_formatter.rb', line 29

def format_fermentable(f)
  puts "#{f.formatted_amount}\t #{f.name}"
end

#format_hop(h) ⇒ Object



37
38
39
# File 'lib/beer_recipe/text_formatter.rb', line 37

def format_hop(h)
  puts "#{h.formatted_amount}\t#{h.name} (#{h.form})\t#{h.use}\t#{h.formatted_time}\t#{h.formatted_ibu}"
end

#format_mash(mash) ⇒ Object



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

def format_mash(mash)
  puts "\nMash:"
  puts mash.name
  puts
  format_records(mash.steps, :mashstep)
end

#format_mash_step(m) ⇒ Object



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

def format_mash_step(m)
  puts "#{m.name}\t#{m.type}\t#{'%.2f' % m.infuse_amount} L\t#{m.formatted_step_time}\t#{m.formatted_step_temp}"
end

#format_misc(m) ⇒ Object



45
46
47
# File 'lib/beer_recipe/text_formatter.rb', line 45

def format_misc(m)
  puts "#{m.name}\t#{m.formatted_amount} #{m.unit}\t#{m.formatted_time} #{m.time_unit}"
end

#format_recipeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/beer_recipe/text_formatter.rb', line 2

def format_recipe
  puts "Name: #{@recipe.name}"
  puts "Type: #{@recipe.type}"
  puts "Style: #{@recipe.style.name}"
  puts "Batch size: #{'%.0f' % @recipe.batch_size} L"
  puts "Boil time: #{'%.0f' % @recipe.boil_time} min"
  puts "OG: #{@recipe.og}"
  puts "FG: #{@recipe.fg}"
  puts "ABV: #{'%.2f' % @recipe.abv}%"
  puts "IBU: #{'%.0f' % @recipe.ibu}"
end

#format_yeast(y) ⇒ Object



53
54
55
# File 'lib/beer_recipe/text_formatter.rb', line 53

def format_yeast(y)
  puts "#{y.name}\t#{y.product_id}\t#{y.laboratory}\t#{y.form}"
end