Class: Crystal::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/crystal/tags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options)
  @tags = []
  add_hash(options)
  InterpolatesTags.new(self).interpolate!
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



6
7
8
# File 'lib/crystal/tags.rb', line 6

def tags
  @tags
end

Instance Method Details

#filter(pattern = //) ⇒ Object



20
21
22
# File 'lib/crystal/tags.rb', line 20

def filter(pattern = //)
  tags.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
  tags.find{|tag| tag.name == name} || raise(TagNotFound, %|can't find meta tag "#{name}"|)
end