Module: ActsAsPushable

Defined in:
lib/acts_as_pushable.rb,
lib/acts_as_pushable/version.rb,
lib/acts_as_pushable/pushable.rb,
lib/acts_as_pushable/notification.rb,
lib/acts_as_pushable/configuration.rb,
lib/acts_as_pushable/apn/notification.rb,
lib/acts_as_pushable/gcm/notification.rb,
lib/acts_as_pushable/active_record/device.rb,
lib/acts_as_pushable/apn/feedback_service.rb,
lib/generators/acts_as_pushable/install_generator.rb

Defined Under Namespace

Modules: APN, GCM, Generators, Pushable Classes: Configuration, Device, Notification

Constant Summary collapse

LOCK =
Mutex.new
VERSION =
'0.3.1'

Class Method Summary collapse

Class Method Details

.configurationObject



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

def configuration
  @configuration = nil unless defined?(@configuration)
  @configuration || LOCK.synchronize { @configuration ||= ActsAsPushable::Configuration.new }
end

.configure(config_hash = nil) {|configuration| ... } ⇒ Object

Yields:



16
17
18
19
20
21
22
23
24
# File 'lib/acts_as_pushable.rb', line 16

def configure(config_hash=nil)
  if config_hash
    config_hash.each do |k,v|
      configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=")
    end
  end

  yield(configuration) if block_given?
end