Class: Yoda::Store::Actions::ReadFile

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/actions/read_file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry, file, root_path: nil) ⇒ ReadFile

Returns a new instance of ReadFile.

Parameters:



20
21
22
23
24
# File 'lib/yoda/store/actions/read_file.rb', line 20

def initialize(registry, file, root_path: nil)
  @registry = registry
  @file = file
  @root_path = root_path
end

Instance Attribute Details

#fileString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/yoda/store/actions/read_file.rb', line 9

def file
  @file
end

#registryRegistry (readonly)

Returns:



6
7
8
# File 'lib/yoda/store/actions/read_file.rb', line 6

def registry
  @registry
end

Class Method Details

.run(registry, file, root_path: nil) ⇒ void

This method returns an undefined value.

Parameters:



14
15
16
# File 'lib/yoda/store/actions/read_file.rb', line 14

def self.run(registry, file, root_path: nil)
  self.new(registry, file, root_path: root_path).run
end

Instance Method Details

#runvoid

This method returns an undefined value.



27
28
29
30
31
32
# File 'lib/yoda/store/actions/read_file.rb', line 27

def run
  YARD::Registry.clear
  YARD.parse([file])
  patch = YardImporter.new(file).import(YARD::Registry.all + [YARD::Registry.root]).patch
  registry.add_patch(patch)
end