Class: Wasserstand::Measurement

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, value, trend) ⇒ Measurement

Returns a new instance of Measurement.



5
6
7
# File 'lib/wasserstand/measurement.rb', line 5

def initialize(date, value, trend)
  @date, @value, @trend = date, value, trend
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/wasserstand/measurement.rb', line 3

def date
  @date
end

#trendObject (readonly)

Returns the value of attribute trend.



3
4
5
# File 'lib/wasserstand/measurement.rb', line 3

def trend
  @trend
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/wasserstand/measurement.rb', line 3

def value
  @value
end

Instance Method Details

#to_iObject



9
10
11
# File 'lib/wasserstand/measurement.rb', line 9

def to_i
  @value
end

#to_sObject



13
14
15
# File 'lib/wasserstand/measurement.rb', line 13

def to_s
  "#{@date.getlocal}: #{@value} cm, Trend #{@trend}"
end