lib/sandboxy/configuration.rb in sandboxy-3.0.0 vs lib/sandboxy/configuration.rb in sandboxy-3.0.1

- old
+ new

@@ -1,48 +1,47 @@ -module Sandboxy - - class << self - attr_accessor :configuration - - def environment - $sandboxy ||= Sandboxy.configuration.default - $sandboxy - end - - def environment= value - $sandboxy = value - end - - def method_missing m, *args - if m.to_s[/(.+)_environment?/] - self.environment? $1 - else - super - end - end - - def respond_to? m, include_private = false - super || m.to_s[/(.+)_environment?/] - end - - def environment? value - self.environment == value - end - end - - def self.configure - self.configuration ||= Configuration.new - yield configuration - end - - class Configuration - - attr_accessor :default - attr_accessor :retain - - def initialize - @default = 'live' - @retain = false - end - - end -end +# frozen_string_literal: true + +module Sandboxy + class << self + attr_accessor :configuration + + def environment + $sandboxy ||= Sandboxy.configuration.default + $sandboxy + end + + def environment=(value) + $sandboxy = value + end + + def method_missing(method, *args) + if method.to_s[/(.+)_environment?/] + environment?($1) + else + super + end + end + + def respond_to_missing?(method, include_private = false) + super || method.to_s[/(.+)_environment?/] + end + + def environment?(value) + environment == value + end + end + + def self.configure + self.configuration ||= Configuration.new + yield configuration + end + + class Configuration + attr_accessor :default + attr_accessor :retain + + def initialize + @default = 'live' + @retain = false + end + end +end