Class: AlwaysBeContributing::Contribution

Inherits:
Struct
  • Object
show all
Defined in:
lib/always_be_contributing/contribution.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, value) ⇒ Contribution

Returns a new instance of Contribution.



9
10
11
12
# File 'lib/always_be_contributing/contribution.rb', line 9

def initialize(date, value)
  self.date = Date.parse(date)
  self.value = value
end

Instance Attribute Details

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



4
5
6
# File 'lib/always_be_contributing/contribution.rb', line 4

def date
  @date
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



4
5
6
# File 'lib/always_be_contributing/contribution.rb', line 4

def value
  @value
end

Class Method Details

.from_raw(raw) ⇒ Object



5
6
7
# File 'lib/always_be_contributing/contribution.rb', line 5

def self.from_raw(raw)
  AlwaysBeContributing::Contribution.new(raw[0],raw[1])
end

Instance Method Details

#nil?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/always_be_contributing/contribution.rb', line 14

def nil?
  self.date.nil? || self.value.nil?
end