Class: Crystal::Tags
- Inherits:
-
Object
- Object
- Crystal::Tags
- Defined in:
- lib/crystal/tags.rb
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #filter(pattern = //) ⇒ Object
- #find_by_name(name) ⇒ Object
-
#initialize(options) ⇒ Tags
constructor
A new instance of Tags.
Constructor Details
#initialize(options) ⇒ Tags
Returns a new instance of Tags.
9 10 11 12 13 |
# File 'lib/crystal/tags.rb', line 9 def initialize() @tags = [] add_hash() InterpolatesTags.new(self).interpolate! end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
6 7 8 |
# File 'lib/crystal/tags.rb', line 6 def @tags end |
Instance Method Details
#filter(pattern = //) ⇒ Object
20 21 22 |
# File 'lib/crystal/tags.rb', line 20 def filter(pattern = //) .select{|tag| pattern === tag.name} end |
#find_by_name(name) ⇒ Object
15 16 17 18 |
# File 'lib/crystal/tags.rb', line 15 def find_by_name(name) name = name.to_s .find{|tag| tag.name == name} || raise(TagNotFound, %|can't find meta tag "#{name}"|) end |