Class: Kameleoon::Data

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

Overview

Represents base class for any Kameleoon data

Direct Known Subclasses

DuplicationSafeData, DuplicationUnsafeData

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_type) ⇒ Data

Returns a new instance of Data.



31
32
33
34
# File 'lib/kameleoon/data/data.rb', line 31

def initialize(data_type)
  @instance = data_type
  @state = DataState::UNSENT
end

Instance Attribute Details

#instanceObject (readonly)

Returns the value of attribute instance.



29
30
31
# File 'lib/kameleoon/data/data.rb', line 29

def instance
  @instance
end

Instance Method Details

#mark_as_sentObject



60
61
62
63
# File 'lib/kameleoon/data/data.rb', line 60

def mark_as_sent
  @state = DataState::SENT
  @nonce = nil
end

#mark_as_transmittingObject



56
57
58
# File 'lib/kameleoon/data/data.rb', line 56

def mark_as_transmitting
  @state = DataState::TRANSMITTING if unsent
end

#mark_as_unsentObject



52
53
54
# File 'lib/kameleoon/data/data.rb', line 52

def mark_as_unsent
  @state = DataState::UNSENT if transmitting
end

#obtain_full_post_text_lineObject

Raises:

  • (KameleoonError.new('ToDo: implement this method.'))


36
37
38
# File 'lib/kameleoon/data/data.rb', line 36

def obtain_full_post_text_line
  raise KameleoonError.new('ToDo: implement this method.'), 'ToDo: implement this method.'
end

#sentObject



48
49
50
# File 'lib/kameleoon/data/data.rb', line 48

def sent
  @state == DataState::SENT
end

#transmittingObject



44
45
46
# File 'lib/kameleoon/data/data.rb', line 44

def transmitting
  @state == DataState::TRANSMITTING
end

#unsentObject



40
41
42
# File 'lib/kameleoon/data/data.rb', line 40

def unsent
  @state == DataState::UNSENT
end