Class: JsDuck::MetaTagLoader
- Inherits:
-
Object
- Object
- JsDuck::MetaTagLoader
- Defined in:
- lib/jsduck/meta_tag_loader.rb
Overview
Loader for built-in and user-defined meta-tags.
Instance Attribute Summary collapse
-
#meta_tags ⇒ Object
readonly
Returns the value of attribute meta_tags.
Instance Method Summary collapse
-
#initialize ⇒ MetaTagLoader
constructor
A new instance of MetaTagLoader.
-
#load(path) ⇒ Object
Loads user-defined meta-tags from given path.
Constructor Details
#initialize ⇒ MetaTagLoader
Returns a new instance of MetaTagLoader.
9 10 11 12 |
# File 'lib/jsduck/meta_tag_loader.rb', line 9 def initialize @classes = [] @meta_tags = [] end |
Instance Attribute Details
#meta_tags ⇒ Object (readonly)
Returns the value of attribute meta_tags.
7 8 9 |
# File 'lib/jsduck/meta_tag_loader.rb', line 7 def @meta_tags end |
Instance Method Details
#load(path) ⇒ Object
Loads user-defined meta-tags from given path.
-
If path is a directory, loads all *.rb files in it.
-
If path is the symbol :builtins, loads the builtin tags from ./tag dir.
-
Otherwise loads tags from the single file.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jsduck/meta_tag_loader.rb', line 20 def load(path) if path == :builtins load(File.dirname(__FILE__) + "/tag") elsif File.directory?(path) # Sort paths, so they are always loaded in the same order. # This is important for signatures to always be rendered in # the same order. Dir[path+"/**/*.rb"].sort.each {|file| load_file(file) } else load_file(path) end end |