Sha256: 25aec126aad8d8300ee4531d732b7e37819d6e0f178b03e283a13ab88b575f6e

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'active_support/configurable'

module ShortMessage
  def self.configure(&block)
    yield @config ||= ShortMessage::Configuration.new
  end
  
  def self.config
    @config
  end
  
  class Configuration #:nodoc:
    include ActiveSupport::Configurable
    config_accessor :gateway_server
    config_accessor :gateway_port
    config_accessor :send_file_path
    config_accessor :account_functions_path
    
    config_accessor :user_id
    config_accessor :ccu_id
    config_accessor :id_string
    
    config_accessor :default_sms_sender
    config_accessor :default_reload_amount
    config_accessor :reload_notification_email
    config_accessor :voucher_notification_email
    config_accessor :default_mail_sender
    
    def param_name
      config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
    end
    
    # define param_name writer (copied from AS::Configurable)
    writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
    singleton_class.class_eval writer, __FILE__, line
    class_eval writer, __FILE__, line
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
short_message-0.0.6 lib/short_message/config.rb
short_message-0.0.5 lib/short_message/config.rb
short_message-0.0.4 lib/short_message/config.rb
short_message-0.0.3 lib/short_message/config.rb