Class: Blacksmith::Hammer

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

Instance Method Summary collapse

Constructor Details

#initialize(url: nil) ⇒ Hammer

Returns a new instance of Hammer.



5
6
7
8
# File 'lib/blacksmith/hammer.rb', line 5

def initialize(url: nil)
  @target_room = Blacksmith::Config.room
  @url = url
end

Instance Method Details

#connectionObject



10
11
12
# File 'lib/blacksmith/hammer.rb', line 10

def connection
  Blacksmith::Config.connection
end

#slamObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/blacksmith/hammer.rb', line 14

def slam
  options = {
    message_format: "html",
  }

  connection[@target_room].send(
    Blacksmith::Config.title, 
    "<img src=\"#{@url}\" />", 
    options
  )
end