Class: Overlord

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collected_error) ⇒ Overlord

Returns a new instance of Overlord.



18
19
20
# File 'lib/stack_overlord.rb', line 18

def initialize(collected_error)
  @error = {message: collected_error.message, error_class: collected_error.class}
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



16
17
18
# File 'lib/stack_overlord.rb', line 16

def error
  @error
end

Class Method Details

.make_overlordObject



22
23
24
25
# File 'lib/stack_overlord.rb', line 22

def self.make_overlord
  @stack_master = Overlord.new($!)
  @stack_master.run
end

Instance Method Details

#mashObject



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

def mash
  Mac.addr.encrypt
end

#post_messageObject



31
32
33
# File 'lib/stack_overlord.rb', line 31

def post_message
  RestClient.post "http://www.stackoverlord.com/#{mash}", @error.to_json, :content_type => :json, :accept => :json
end


35
36
37
# File 'lib/stack_overlord.rb', line 35

def puts_link
  puts "\e[31m Your Overlord resides here: http://www.stackoverlord.com/#{mash} \e[0m"
end

#runObject



39
40
41
42
# File 'lib/stack_overlord.rb', line 39

def run
  self.post_message
  self.puts_link
end