Class: GistWorker::Worker

Inherits:
IronWorker::Base
  • Object
show all
Defined in:
lib/gist_worker/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gist_fileObject

Returns the value of attribute gist_file.



9
10
11
# File 'lib/gist_worker/worker.rb', line 9

def gist_file
  @gist_file
end

#gist_idObject

Returns the value of attribute gist_id.



9
10
11
# File 'lib/gist_worker/worker.rb', line 9

def gist_id
  @gist_id
end

#gist_urlObject

Returns the value of attribute gist_url.



9
10
11
# File 'lib/gist_worker/worker.rb', line 9

def gist_url
  @gist_url
end

#paramsObject

Returns the value of attribute params.



9
10
11
# File 'lib/gist_worker/worker.rb', line 9

def params
  @params
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gist_worker/worker.rb', line 11

def run

  unless gist_url
    @gist_url = "https://raw.github.com/gist/#{gist_id}/#{gist_file}"
  end

  # get gist
  gist_file = user_dir + "gist.rb"
  File.open(gist_file, 'wb') do |fo|
    fo.write open(gist_url).read
  end

  $params = @params
  # run gist
  load(gist_file)

end