Sha256: f742b56d838396c54d1193bc7370ae127858fccec3f602cf3739adb2df4c2949
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
module JakubMyNewGem class Build 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 |
---|---|
jakub_my_new_gem-0.1.1 | lib/jakub_my_new_gem/build.rb |