Sha256: ea20a4cc603689219e61480f03462d82bcb2ec09b6eb0de0fe8f63d0fd598489

Contents?: true

Size: 779 Bytes

Versions: 9

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

module StatsLite
  class Configuration
    def initialize
      @port = 9111
      @watch = ["config.rb"]
    end

    def port(_port = nil)
      _port ? @port = _port : @port
    end

    def app
      _app = StatsLite::App
      if block_given?
        yield app
      else
        _app
      end
    end

    def watch(_paths = nil)
      _paths ? @watch = _paths : @watch
    end

    def password(_pass = nil)
      _pass ? @password = _pass : @password
    end

    def data(_data = nil)
      _data ? @data = _data : @data
    end
  end

  class << self
    def configure
      config = @configuration ||= Configuration.new
      if block_given?
        yield config, StatsLite::Helper
      else
        config
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stats_lite-0.6.2 lib/stats_lite/configure.rb
stats_lite-0.6.1 lib/stats_lite/configure.rb
stats_lite-0.6.0 lib/stats_lite/configure.rb
stats_lite-0.5.4 lib/stats_lite/configure.rb
stats_lite-0.5.3 lib/stats_lite/configure.rb
stats_lite-0.5.2 lib/stats_lite/configure.rb
stats_lite-0.5.1 lib/stats_lite/configure.rb
stats_lite-0.5.0 lib/stats_lite/configure.rb
stats_lite-0.1.0 lib/stats_lite/configure.rb