Module: RemoteResource::Notifications

Included in:
AttributeHttpClient, AttributeStorageValue, Attributes
Defined in:
lib/remote_resource/notifications.rb

Instance Method Summary collapse

Instance Method Details

#instrument(*args, &block) ⇒ Object



5
6
7
8
# File 'lib/remote_resource/notifications.rb', line 5

def instrument(*args, &block)
  args[0] = args[0] + '.remote_resource' unless args[0].include?('.')
  ActiveSupport::Notifications.instrument(*args, &block)
end

#instrument_attribute(*args, &block) ⇒ Object



10
11
12
13
14
15
# File 'lib/remote_resource/notifications.rb', line 10

def instrument_attribute(*args, &block)
  fail ArgumentError unless args[1].is_a? AttributeSpecification
  args.push({}) unless args.last.is_a? Hash
  args.last.merge!(attribute: args.delete_at(1).to_hash)
  instrument(*args, &block)
end