Class: RBCM::Project::ProjectFile
- Inherits:
-
Object
- Object
- RBCM::Project::ProjectFile
- Defined in:
- app/project/file.rb
Overview
extracts capabilities and definitions from project files
Instance Attribute Summary collapse
-
#addon_names ⇒ Object
readonly
Returns the value of attribute addon_names.
-
#addons ⇒ Object
readonly
Returns the value of attribute addons.
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#definitions ⇒ Object
readonly
Returns the value of attribute definitions.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project:, path:) ⇒ ProjectFile
constructor
A new instance of ProjectFile.
Constructor Details
#initialize(project:, path:) ⇒ ProjectFile
Returns a new instance of ProjectFile.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/project/file.rb', line 4 def initialize project:, path: @project = project @path = path @definitions = [] @capabilities = [] @addons = [] file = File.read path method_names_cache = methods(false) instance_eval file sandbox = RBCM::Project::Sandbox.dup sandbox.module_eval(file) sandbox.instance_methods.each do |name| raise "ERROR: capability name '#{name}' not allowed" if [:node, :group].include? name @capabilities.append RBCM::Project::Capability.new( name: name, content: sandbox.instance_method(name), project_file: self ) end end |
Instance Attribute Details
#addon_names ⇒ Object (readonly)
Returns the value of attribute addon_names.
25 26 27 |
# File 'app/project/file.rb', line 25 def addon_names @addon_names end |
#addons ⇒ Object (readonly)
Returns the value of attribute addons.
25 26 27 |
# File 'app/project/file.rb', line 25 def addons @addons end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
25 26 27 |
# File 'app/project/file.rb', line 25 def capabilities @capabilities end |
#definitions ⇒ Object (readonly)
Returns the value of attribute definitions.
25 26 27 |
# File 'app/project/file.rb', line 25 def definitions @definitions end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
25 26 27 |
# File 'app/project/file.rb', line 25 def path @path end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
25 26 27 |
# File 'app/project/file.rb', line 25 def project @project end |