Class: Hocho::PropertyProviders::RubyScript
- Inherits:
-
Object
- Object
- Hocho::PropertyProviders::RubyScript
- Defined in:
- lib/hocho/property_providers/ruby_script.rb
Defined Under Namespace
Classes: Template
Instance Method Summary collapse
- #determine(host) ⇒ Object
-
#initialize(name: nil, script: nil, file: nil) ⇒ RubyScript
constructor
A new instance of RubyScript.
Constructor Details
#initialize(name: nil, script: nil, file: nil) ⇒ RubyScript
Returns a new instance of RubyScript.
4 5 6 7 8 9 10 11 |
# File 'lib/hocho/property_providers/ruby_script.rb', line 4 def initialize(name: nil, script: nil, file: nil) @template = case when script compile(script, "(#{name || 'ruby_script'})") when file compile(File.read(file), name ? "(#{name})" : file) end end |
Instance Method Details
#determine(host) ⇒ Object
13 14 15 16 |
# File 'lib/hocho/property_providers/ruby_script.rb', line 13 def determine(host) @template.new(host).run nil end |