Sha256: 13abbd88816f55dfdcf78c57365da6fb73b934b1c812050be989accc1ede041b

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

##
# spec/support/configurables.rb
#

class MyApp
  include SknUtils::Configurable.with( :app_id, :title, :cookie_name, enable_root: true) # No options hash defaults to true
  # - and accept defaults for #env=, #root=, #registry=, and #logger=

  # notice: self.logger=, the self is required when assigning values
  self.logger = Object.new
  self.registry = Object.new

  configure do
    app_id 'some app'
    title 'My Title'
    cookie_name 'Chocolate'
  end

  def null_value
    self.class.config.app_id.dup
  end
end

module MyMod
  include SknUtils::Configurable.with(:app_id, :title, :cookie_name,  enable_root: false)

  def self.null_value
    config.app_id.dup
  end
end

MyMod.configure do
  app_id 'some module'
  title 'Some Title'
  cookie_name 'Caramel'
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skn_utils-5.8.0 spec/support/configurables.rb
skn_utils-5.7.0 spec/support/configurables.rb
skn_utils-5.6.0 spec/support/configurables.rb
skn_utils-5.5.0 spec/support/configurables.rb
skn_utils-5.4.1 spec/support/configurables.rb