Class: Metaa::TagCollection
- Inherits:
-
Object
- Object
- Metaa::TagCollection
- Defined in:
- lib/metaa/tag_collection.rb
Instance Method Summary collapse
- #add(new_tags) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(tags = []) ⇒ TagCollection
constructor
A new instance of TagCollection.
- #tags ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(tags = []) ⇒ TagCollection
Returns a new instance of TagCollection.
3 4 5 |
# File 'lib/metaa/tag_collection.rb', line 3 def initialize( = []) add() end |
Instance Method Details
#add(new_tags) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/metaa/tag_collection.rb', line 15 def add() = [] if !.is_a? Array .each do |tag| tag = Tag.new(tag) if !tag.is_a?(Tag) << tag end end |
#empty? ⇒ Boolean
11 12 13 |
# File 'lib/metaa/tag_collection.rb', line 11 def empty? .empty? end |
#tags ⇒ Object
7 8 9 |
# File 'lib/metaa/tag_collection.rb', line 7 def @tags ||= [] end |
#to_html ⇒ Object
23 24 25 |
# File 'lib/metaa/tag_collection.rb', line 23 def to_html .map(&:to_html).join.html_safe end |