Class: Nucleo::Models::Element

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/nucleo/models/element.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Element

Returns a new instance of Element.



6
7
8
# File 'lib/nucleo/models/element.rb', line 6

def initialize(attributes={})
  @attributes = attributes
end

Instance Method Details

#altObject



18
19
20
# File 'lib/nucleo/models/element.rb', line 18

def alt
  @attributes.fetch('alt', '')
end

#contentObject



10
11
12
# File 'lib/nucleo/models/element.rb', line 10

def content
  @attributes.fetch('content', '')
end

#content_empty?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/nucleo/models/element.rb', line 26

def content_empty?
  self.content.empty?
end

#content_lengthObject



22
23
24
# File 'lib/nucleo/models/element.rb', line 22

def content_length
  self.content.length
end

#content_present?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/nucleo/models/element.rb', line 30

def content_present?
  self.content.present?
end

#htmlObject



34
35
36
# File 'lib/nucleo/models/element.rb', line 34

def html
  @attributes.fetch('html', '')
end

#srcObject



14
15
16
# File 'lib/nucleo/models/element.rb', line 14

def src
  @attributes.fetch('src', '')
end