Class: Amber::Switch::Content::Text

Inherits:
Amber::Switch::Content show all
Includes:
Amber::Switch::ContentDelegate
Defined in:
lib/amber/switch/content/text.rb

Constant Summary

Constants inherited from Amber::Switch::Content

FORM_DATA_CONTENT, JSON_CONTENT, TEXT_CONTENT

Instance Attribute Summary

Attributes inherited from Amber::Switch::Content

#type

Instance Method Summary collapse

Methods inherited from Amber::Switch::Content

#body, #body=, #data

Constructor Details

#initialize(data = "") ⇒ Text

Returns a new instance of Text.



4
5
6
# File 'lib/amber/switch/content/text.rb', line 4

def initialize(data = "")
  super Amber::Switch::Content::TEXT_CONTENT, data
end

Instance Method Details

#data=(data) ⇒ Object



8
9
10
11
12
# File 'lib/amber/switch/content/text.rb', line 8

def data=(data)
  if data.is_a? String
    super
  end
end

#deserialize(data) ⇒ Object



17
18
19
# File 'lib/amber/switch/content/text.rb', line 17

def deserialize(data)
  data.to_s
end

#serialize(data) ⇒ Object



13
14
15
# File 'lib/amber/switch/content/text.rb', line 13

def serialize(data)
  data.to_s
end