Class: Lookbook::Parser
- Inherits:
-
Object
- Object
- Lookbook::Parser
- Defined in:
- lib/lookbook/parser.rb
Instance Attribute Summary collapse
-
#registry_path ⇒ Object
readonly
Returns the value of attribute registry_path.
Class Method Summary collapse
Instance Method Summary collapse
- #get_code_object(path) ⇒ Object
-
#initialize(paths, registry_path) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(paths, registry_path) ⇒ Parser
Returns a new instance of Parser.
6 7 8 9 10 |
# File 'lib/lookbook/parser.rb', line 6 def initialize(paths, registry_path) @paths = paths.map { |p| "#{p}/**/*preview.rb" } @registry_path = registry_path.to_s YARD::Registry.yardoc_file = registry_path end |
Instance Attribute Details
#registry_path ⇒ Object (readonly)
Returns the value of attribute registry_path.
5 6 7 |
# File 'lib/lookbook/parser.rb', line 5 def registry_path @registry_path end |
Class Method Details
.define_tags ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/lookbook/parser.rb', line 27 def YARD::Tags::Library.define_tag("Hidden status", :hidden) YARD::Tags::Library.define_tag("Label", :label) YARD::Tags::Library.define_tag("Display", :display) YARD::Tags::Library.define_tag("Position", :position) YARD::Tags::Library.define_tag("ID", :id) end |
Instance Method Details
#get_code_object(path) ⇒ Object
20 21 22 23 24 |
# File 'lib/lookbook/parser.rb', line 20 def get_code_object(path) registry = YARD::RegistryStore.new registry.load!(registry_path) registry.get(path) end |
#parse ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/lookbook/parser.rb', line 12 def parse YARD::Registry.clear YARD::Registry.lock_for_writing do YARD.parse(@paths) YARD::Registry.save(false, registry_path) end end |