Class: Evergreen::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/evergreen/helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suite, name) ⇒ Helper


6
7
8
9
# File 'lib/evergreen/helper.rb', line 6

def initialize(suite, name)
  @suite = suite
  @name  = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


4
5
6
# File 'lib/evergreen/helper.rb', line 4

def name
  @name
end

#suiteObject (readonly)

Returns the value of attribute suite


4
5
6
# File 'lib/evergreen/helper.rb', line 4

def suite
  @suite
end

Instance Method Details

#exist?Boolean


29
30
31
# File 'lib/evergreen/helper.rb', line 29

def exist?
  File.exist?(full_path)
end

#full_pathObject


15
16
17
# File 'lib/evergreen/helper.rb', line 15

def full_path
  File.join(root, Evergreen.helper_dir, name)
end

#readObject Also known as: contents


19
20
21
22
23
24
25
26
# File 'lib/evergreen/helper.rb', line 19

def read
  if full_path =~ /\.coffee$/
    require 'coffee-script'
    CoffeeScript.compile(File.read(full_path))
  else
    File.read(full_path)
  end
end

#rootObject


11
12
13
# File 'lib/evergreen/helper.rb', line 11

def root
  suite.root
end