Class: OGTraf::Deviation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datablock) ⇒ Deviation

Returns a new instance of Deviation.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ogtraf/deviation.rb', line 8

def initialize(datablock)
  @header = datablock[:Header]
  @summary = datablock[:Summary] || datablock[:PublicNote]
  @details = datablock[:Details]
  @text = datablock[:ShortText]

  @from = Time.now
  @to = Time.now

  datablock[:DeviationScopes].each do |dev|
    from = Time.parse dev[:FromDateTime]
    @from = from if @from > from
    to = Time.parse dev[:ToDateTime]
    @to = to if @to < to
  end
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def details
  @details
end

#fromObject (readonly)

Returns the value of attribute from.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def from
  @from
end

#headerObject (readonly)

Returns the value of attribute header.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def header
  @header
end

#summaryObject (readonly)

Returns the value of attribute summary.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def summary
  @summary
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def text
  @text
end

#toObject (readonly)

Returns the value of attribute to.



6
7
8
# File 'lib/ogtraf/deviation.rb', line 6

def to
  @to
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/ogtraf/deviation.rb', line 25

def to_s
  @header.to_s
end