Sha256: df33227dbe6ee749b397598e971fb4775808ceaaab96c01a1b6b6e7bbf9050c0

Contents?: true

Size: 1.56 KB

Versions: 15

Compression:

Stored size: 1.56 KB

Contents

module Screengem
  class << self
    attr_accessor :configuration
  end

  #
  # Expose the configuration to users of the Screengem gem.
  #
  def self.configure
    self.configuration ||= Screengem::Configuration.new

    yield(configuration)
  end

  #
  # Configuration for the Screengem gem.
  #
  class Configuration
    # The name of the YAML file that is used to configure dampening.
    attr_accessor :dampen_configuration_filename

    # The top level key in the YAML file that is used to configure dampening.
    attr_accessor :dampen_configuration_root

    # A boolean that specifies that dampening is to be applied.
    attr_accessor :apply_dampening

    # A boolean that specifies that browser actions are created (used by the ActionFactory).
    attr_accessor :browser_actions

    # A string that namespaces action classes (used by the ActionFactory).
    attr_accessor :action_scope

    # A string that namespaces questions classes (used by the QuestionFactory).
    attr_accessor :question_scope

    # A string that namespaces task classes (used by the TaskFactory).
    attr_accessor :task_scope

    def initialize
      self.apply_dampening = false
      self.browser_actions = false

      self.dampen_configuration_root = "default"

      self.action_scope = "Actions"
      self.question_scope = "Questions"
      self.task_scope = "Tasks"
    end

    def apply_dampening?
      apply_dampening
    end

    def browser_actions?
      browser_actions
    end

    def dampen_configuration_sample_filename
      "#{dampen_configuration_filename}.sample"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
screengem-0.9.1 lib/screengem/configuration.rb
screengem-0.9.0 lib/screengem/configuration.rb
screengem-0.8.1 lib/screengem/configuration.rb
screengem-0.8.0 lib/screengem/configuration.rb
screengem-0.7.3 lib/screengem/configuration.rb
screengem-0.7.2 lib/screengem/configuration.rb
screengem-0.7.1 lib/screengem/configuration.rb
screengem-0.6.0 lib/screengem/configuration.rb
screengem-0.5.0 lib/screengem/configuration.rb
screengem-0.4.0 lib/screengem/configuration.rb
screengem-0.3.0 lib/screengem/configuration.rb
screengem-0.2.0 lib/screengem/configuration.rb
screengem-0.1.2 lib/screengem/configuration.rb
screengem-0.1.1 lib/screengem/configuration.rb
screengem-0.1.0 lib/screengem/configuration.rb