Class: Project::ProjectFile

Inherits:
Object
  • Object
show all
Defined in:
app/project/file.rb

Overview

extracts capabilities and definitions from project files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_file_path) ⇒ ProjectFile

Returns a new instance of ProjectFile.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/project/file.rb', line 4

def initialize project_file_path
  @path = project_file_path
  @definitions = []
  @capabilities = []
  file = File.read project_file_path
  method_names_cache = methods(false)
  instance_eval file
  sandbox = Project::Sandbox.dup
  sandbox.module_eval(file)
  sandbox.instance_methods.each do |name|
    @capabilities.append Project::Capability.new(
      name:    name,
      content: sandbox.instance_method(name)
    )
  end
end

Instance Attribute Details

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



21
22
23
# File 'app/project/file.rb', line 21

def capabilities
  @capabilities
end

#definitionsObject (readonly)

Returns the value of attribute definitions.



21
22
23
# File 'app/project/file.rb', line 21

def definitions
  @definitions
end

#pathObject (readonly)

Returns the value of attribute path.



21
22
23
# File 'app/project/file.rb', line 21

def path
  @path
end