Sha256: b7d84a78109a3ad630d8f960f1d6a2724fe5f7ffac56509fcfeb6d6032f6a97a
Contents?: true
Size: 551 Bytes
Versions: 1
Compression:
Stored size: 551 Bytes
Contents
module TippyMun class Builder def initialize :total, :quantity @total = total @gratuity = gratuity end def generate return calculation if number_based? string_based? end def string_based? (@gratuity.is_a? Numeric) || (@gratuity.integer?) end def string_based def @gratuity.downcase when 'high' then calculation 25 when 'standard' then calculation 18 when 'low' then calculation 15 end end def calculation gratuity = @gratuity @total += @total * (@quantity.to_f / 100) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tippy_mun-0.1.0 | lib/tippy_mun/builder.rb |