Class: Hocho::PropertyProviders::RubyScript

Inherits:
Object
  • Object
show all
Defined in:
lib/hocho/property_providers/ruby_script.rb

Defined Under Namespace

Classes: Template

Instance Method Summary collapse

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