Class: Chiketto::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/chiketto/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Attribute

Returns a new instance of Attribute.



5
6
7
8
9
# File 'lib/chiketto/attribute.rb', line 5

def initialize(hash = {})
  hash ||= {}
  @text = hash.fetch('text') { '' }
  @html = hash.fetch('html') { @text }
end

Instance Attribute Details

#htmlObject

Returns the value of attribute html.



3
4
5
# File 'lib/chiketto/attribute.rb', line 3

def html
  @html
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/chiketto/attribute.rb', line 3

def text
  @text
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/chiketto/attribute.rb', line 11

def to_s
  text
end