Class: SocialUrl::Message

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Message

Returns a new instance of Message.



3
4
5
6
7
# File 'lib/social_url/message.rb', line 3

def initialize(options)
  @options = SocialUrl.normalize(options)

  init_networks
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/social_url/message.rb', line 9

def method_missing(method)
  network = /(.+)_url/.match(method)
  return unless network

  networks = SocialUrl.networks.join(',')
  raise UnsupportedNetworkError,
       "Unsupported network '#{network[1]}'. Choose from: #{networks}."
end