Class: Xanthus::Script

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array, config) ⇒ Script

Returns a new instance of Script.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xanthus/script.rb', line 6

def initialize array, config
  script = ''
  array.each do |t|
    v = eval(config.scripts[t])
    if v.kind_of?(Array)
      v.each do |w|
        script+=w+"\n"
      end
    else
      script+=v
    end
  end
  script_to_clean = script
  script = ''
  script_to_clean.each_line do |s|
    script += s.strip + "\n" unless s=="\n"
  end
  script = script.gsub "\n\n", "\n"
  @script = script
end

Instance Attribute Details

#scriptObject

Returns the value of attribute script.



3
4
5
# File 'lib/xanthus/script.rb', line 3

def script
  @script
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/xanthus/script.rb', line 27

def to_s
  @script
end