Sha256: 4b503b08035e93577e041797e22f2a17553b8b61e35922d543d7854ea2d3e8cd
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
module Embratel class Payable COST_REGEXP = /^\d+(?:\.\d+)?$/ FIELDS = %w[id caller description date number_called caller_local called_local start_time end_time imp country quantity unit cost] FIELDS.each { |field| attr_accessor field.to_sym } def initialize(row) @row = row FIELDS.each_with_index do |field, index| instance_variable_set("@#{field}".to_sym, row[index].to_s.strip) end end def call? is_a?(Call) end def fee? is_a?(Fee) end def valid? @row.size == 14 && !!(cost =~ COST_REGEXP) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
embratel-1.1.2 | lib/embratel/payable.rb |
embratel-1.1.1 | lib/embratel/payable.rb |
embratel-1.1.0 | lib/embratel/payable.rb |