Sha256: 71af7208435e017a702a56344a49eef0bdd4dda282fdee7f3d4af7b2ee49619b
Contents?: true
Size: 377 Bytes
Versions: 2
Compression:
Stored size: 377 Bytes
Contents
module Embratel class PhoneBill attr_reader :payables def initialize(path) @payables = CSVParser.parse(path) end def calls @calls ||= @payables.select(&:call?) end def fees @calls ||= @payables.select(&:fee?) end def total @total ||= payables.inject(0) { |sum, payable| sum += payable.cost.to_f } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
embratel-1.1.1 | lib/embratel/phone_bill.rb |
embratel-1.1.0 | lib/embratel/phone_bill.rb |