Class: Guilded::Data
- Inherits:
-
Object
- Object
- Guilded::Data
- Defined in:
- lib/guilded/data.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #add(data) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Data
constructor
A new instance of Data.
- #to_javascript ⇒ Object
Constructor Details
#initialize ⇒ Data
Returns a new instance of Data.
8 9 10 |
# File 'lib/guilded/data.rb', line 8 def initialize @content = {} end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
6 7 8 |
# File 'lib/guilded/data.rb', line 6 def content @content end |
Instance Method Details
#add(data) ⇒ Object
12 13 14 |
# File 'lib/guilded/data.rb', line 12 def add( data ) content.merge! data end |
#empty? ⇒ Boolean
20 21 22 |
# File 'lib/guilded/data.rb', line 20 def empty? content.empty? end |
#to_javascript ⇒ Object
16 17 18 |
# File 'lib/guilded/data.rb', line 16 def to_javascript "g[\"data\"]=#{content.to_json};" end |