module SmsGatewayTo::Rails
Public Class Methods
load_yaml_config()
click to toggle source
# File lib/sms_gateway_to/rails.rb, line 20 def self.load_yaml_config path = Pathname.new("#{rails_root}/config/smsgateway.yml") if File.exist?(path) cfg = YAML::load(ERB.new(File.read(path)).result) credentials = cfg[rails_env] unless credentials raise "config/smsgateway.yml is missing a section for `#{rails_env}`" end SmsGatewayTo.configure(credentials) else raise "config/smsgateway.yml doesnt exist" end end
setup()
click to toggle source
# File lib/sms_gateway_to/rails.rb, line 15 def self.setup load_yaml_config nil end
Protected Class Methods
rails_env()
click to toggle source
# File lib/sms_gateway_to/rails.rb, line 38 def self.rails_env ::Rails.respond_to?(:env) ? ::Rails.env : RAILS_ENV end
rails_root()
click to toggle source
# File lib/sms_gateway_to/rails.rb, line 42 def self.rails_root ::Rails.respond_to?(:root) ? ::Rails.root.to_s : RAILS_ROOT end