Sha256: 50a6219efcf83dd8018c14d0af89c77243a5c68fb5fb9f98601161cf3d68ea60

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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_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

2 entries across 2 versions & 1 rubygems

Version Path
short_message-0.0.2 lib/short_message/config.rb
short_message-0.0.1 lib/short_message/config.rb