Class: UCCard::ShoppingData

Inherits:
Object
  • Object
show all
Defined in:
lib/uc_card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ShoppingData

Returns a new instance of ShoppingData.



102
103
104
105
106
# File 'lib/uc_card.rb', line 102

def initialize(options={})
  options.each{ |k,v|
    self.send("#{k.to_s}=", v)
  }
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



93
94
95
# File 'lib/uc_card.rb', line 93

def date
  @date
end

#klassObject

Returns the value of attribute klass.



94
95
96
# File 'lib/uc_card.rb', line 94

def klass
  @klass
end

#nameObject

Returns the value of attribute name.



95
96
97
# File 'lib/uc_card.rb', line 95

def name
  @name
end

#noteObject

Returns the value of attribute note.



99
100
101
# File 'lib/uc_card.rb', line 99

def note
  @note
end

#paymentObject

Returns the value of attribute payment.



100
101
102
# File 'lib/uc_card.rb', line 100

def payment
  @payment
end

#timesObject

Returns the value of attribute times.



98
99
100
# File 'lib/uc_card.rb', line 98

def times
  @times
end

#usecaseObject

Returns the value of attribute usecase.



97
98
99
# File 'lib/uc_card.rb', line 97

def usecase
  @usecase
end

#valueObject

Returns the value of attribute value.



96
97
98
# File 'lib/uc_card.rb', line 96

def value
  @value
end

Instance Method Details

#moneyObject



108
109
110
# File 'lib/uc_card.rb', line 108

def money
  @value.gsub(/\D/, '').to_i
end

#to_sObject



112
113
114
115
# File 'lib/uc_card.rb', line 112

def to_s
  #"#{date}: " + [@date, @klass, @name, @value, @usecase, @times, @note, @payment].join(',')
  "#{@date}: #{@name} #{money} #{@usecase} #{@times}"
end