Sha256: 3fdc253659efd6282f2cf711db2b049ea97ee4bfdbb4ce97a002259ad9c862c2

Contents?: true

Size: 972 Bytes

Versions: 5

Compression:

Stored size: 972 Bytes

Contents

module Rtml
  class Configuration
    attr_accessor :widget_paths
    attr_accessor :rtml_helper_paths
    attr_accessor :widget_logging_enabled
    attr_accessor :log_tml

    def initialize
      self.widget_paths = default_widget_paths
      self.rtml_helper_paths = default_rtml_helper_paths
      self.widget_logging_enabled = default_widget_logging_enabled
      self.log_tml = default_log_tml
    end

    # does some basic manipulation to options in order to guesstimate the correct values for erroneous configurations
    def validate!
      widget_paths.flatten!
      widget_paths.uniq!
      rtml_helper_paths.flatten!
      rtml_helper_paths.uniq!
    end

    private
    def default_log_tml
      false
    end

    def default_widget_paths
      ['lib/rtml/widgets', File.join(Rtml.root, 'builtin/widgets')]
    end

    def default_rtml_helper_paths
      ['app/rtml_helpers']
    end

    def default_widget_logging_enabled
      false
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtml-2.0.4 lib/rtml/configuration.rb
rtml-2.0.3 lib/rtml/configuration.rb
rtml-2.0.2 lib/rtml/configuration.rb
rtml-2.0.1 lib/rtml/configuration.rb
rtml-2.0.0.alpha.1 lib/rtml/configuration.rb