Sha256: 1432459e0488a269a5e926f99c76423555813411bfab77c41cd8e85a0fbba0a6
Contents?: true
Size: 656 Bytes
Versions: 1
Compression:
Stored size: 656 Bytes
Contents
module TippyRor # class Error < StandardError; end class Builder def initialize total:, gratuity: @total = total @gratuity = gratuity end def generate return calculation if number_based? string_based end def number_based? (@gratuity.is_a? Numeric) || (@gratuity.integer?) end def string_based case @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 * (gratuity.to_f / 100) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tippy_ror-0.1.0 | lib/tippy_ror/builder.rb |