Module: Beerxml

Defined in:
lib/beerxml.rb,
lib/beerxml/unit.rb,
lib/beerxml/version.rb

Defined Under Namespace

Modules: Properties Classes: Fermentable, Hop, Model, Recipe, Unit, Yeast

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.parse(string_or_io) ⇒ Object



9
10
11
# File 'lib/beerxml.rb', line 9

def self.parse(string_or_io)
  Beerxml::Model.from_xml(Nokogiri::XML(string_or_io).root)
end

.round(float, to = 0) ⇒ Object



13
14
15
16
# File 'lib/beerxml.rb', line 13

def self.round(float, to = 0)
  exp = 10 ** to
  (float * exp).round.to_f / exp
end