Sha256: 2128ca88cac55931ef7278ec3c8b3fe5b2ecf512e722daf1e938b46bfa1557dd
Contents?: true
Size: 844 Bytes
Versions: 1
Compression:
Stored size: 844 Bytes
Contents
module LazyGoogleAnalytics class Config class WrongConfig < StandardError; end def initialize(data={}) @data = {} update!(data) end def update!(data) data.each do |key, value| self[key] = value end end def [](key) @data[key.to_sym] end def []=(key, value) if value.class == Hash @data[key.to_sym] = LazyGoogleAnalytics::Config.new(value) else @data[key.to_sym] = value end end def method_missing(sym, *args) if sym.to_s =~ /(.+)=$/ self[$1] = args.first else self[sym] end end def has_required_keys? res = @data.keys - [:pass_phrase, :key_file, :client_id, :scope, :profile_id, :email] raise LazyGoogleAnalytics::Config::WrongConfig unless res.empty? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_google_analytics-0.0.1 | lib/lazy_google_analytics/config.rb |