Sha256: 88d1fec2838a20acb5efc553872c4a32508f781b7949bb6ca80737db317d4fc0

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

module Zymurgy
  def self.included(base)
    base.send :extend, ClassMethods
  end

  module ClassMethods
    def acts_as_fermentable(options = {})
      send :include, InstanceMethods
    end
  end

  module InstanceMethods
    def volume_gravity_points volume_litres
      maximum_volume_gravity_points = (send(:points_per_kg_per_litre) / volume_litres) * send(:weight_in_kg)

      return maximum_volume_gravity_points unless send(:mash)
      return maximum_volume_gravity_points * send(:mash_efficiency_percentage) / 100
    end

    def post_boil_volume_gravity_points
      volume_gravity_points(send(:post_boil_volume_litres))
    end

    def pre_boil_volume_gravity_points
      volume_gravity_points send(:mash_out_volume_litres)
    end

  end
end

ActiveRecord::Base.send :include, Zymurgy

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zymurgy-0.10.0 lib/zymurgy/acts_as_fermentable.rb