Class: VagrantPlugins::DevCommands::Commandfile::Reader
- Inherits:
-
Object
- Object
- VagrantPlugins::DevCommands::Commandfile::Reader
- Defined in:
- lib/vagrant/devcommands/commandfile/reader.rb
Overview
Provides the DSL to read the contents of a Commandfile
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Instance Method Summary collapse
-
#initialize(commandfile, env) ⇒ Reader
constructor
A new instance of Reader.
- #read ⇒ Object
Constructor Details
#initialize(commandfile, env) ⇒ Reader
Returns a new instance of Reader.
10 11 12 13 14 15 |
# File 'lib/vagrant/devcommands/commandfile/reader.rb', line 10 def initialize(commandfile, env) @commandfile = commandfile @env = env @entries = [] end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
8 9 10 |
# File 'lib/vagrant/devcommands/commandfile/reader.rb', line 8 def entries @entries end |
Instance Method Details
#read ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant/devcommands/commandfile/reader.rb', line 17 def read global = @commandfile.path_global local = @commandfile.path contents = '' contents += "\n#{global.read}" unless global.nil? contents += "\n#{local.read}" unless local.nil? instance_eval(contents) @entries end |