Class: Nucleo::Models::Tag
- Inherits:
-
Object
- Object
- Nucleo::Models::Tag
- Includes:
- Comparable
- Defined in:
- lib/nucleo/models/tag.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#content_length ⇒ Integer
(also: #length)
Returns the content length.
-
#full_tag ⇒ String
(also: #raw_content)
Returns the full tag content.
-
#initialize(attributes = {}) ⇒ Tag
constructor
A new instance of Tag.
-
#snippet ⇒ String
Returns the HTML wrapped snippet.
-
#tag_content ⇒ String
(also: #content)
Returns the tag content.
Constructor Details
#initialize(attributes = {}) ⇒ Tag
Returns a new instance of Tag.
6 7 8 |
# File 'lib/nucleo/models/tag.rb', line 6 def initialize(attributes={}) @attributes = attributes end |
Instance Method Details
#<=>(other) ⇒ Object
10 11 12 |
# File 'lib/nucleo/models/tag.rb', line 10 def <=>(other) self.length <=> other.length end |
#content_length ⇒ Integer Also known as: length
Returns the content length
33 34 35 |
# File 'lib/nucleo/models/tag.rb', line 33 def content_length @attributes['content_length'].to_i end |
#full_tag ⇒ String Also known as: raw_content
Returns the full tag content
17 18 19 |
# File 'lib/nucleo/models/tag.rb', line 17 def full_tag @attributes['full_tag'] end |
#snippet ⇒ String
Returns the HTML wrapped snippet
@todo: Extract this to a view helper
43 44 45 |
# File 'lib/nucleo/models/tag.rb', line 43 def snippet "<p><code>%s</code></p>" % [CGI.escapeHTML(self.full_tag)] end |
#tag_content ⇒ String Also known as: content
Returns the tag content
25 26 27 |
# File 'lib/nucleo/models/tag.rb', line 25 def tag_content @attributes['tag_content'] end |