Class: Ruboty::Hubot::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/ruboty/hubot/script.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_path) ⇒ Script

Returns a new instance of Script.



7
8
9
10
11
12
13
# File 'lib/ruboty/hubot/script.rb', line 7

def initialize(source_path)
  if File.extname(source_path).downcase == '.coffee'
    @source = CoffeeScript.compile(File.read(source_path), bare: true)
  else
    @source = File.read(source_path)
  end
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/ruboty/hubot/script.rb', line 15

def to_s
  @source.to_s
end