Sha256: a5dda0d610b3b7269cf8daa29c295ed2852a6e7d110b33905cb9bd1f66ad6be0

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/hash'
require 'yaml'

require 'redpomo/file_cache'
require 'redpomo/null_cache'

module Redpomo
  module Config

    mattr_reader :todo_path, :trackers_data, :cache

    @@cache = NullCache

    def self.load_from_yaml(path)
      data = YAML::load_file(File.expand_path(path))

      @@todo_path = File.expand_path(data["todo"])
      @@trackers_data = data["trackers"].symbolize_keys!
      @@cache = data["cache"] ? FileCache : NullCache
    end

    # def todo_path
    #   File.expand_path(@data["todo"])
    # end

    # def tasks
    #   @tasks ||= Todo::List.new(todo_path)
    # end

    # def find_task(number)
    #   tasks[number.to_i - 1]
    # end

    # def trackers
    #   @trackers ||= @data["trackers"].map do |key, data|
    #     Tracker.new(data.merge(name: key))
    #   end
    # end

    # def issues
    #   [].tap do |issues|
    #     trackers.each do |tracker|
    #       issues << tracker.issues
    #     end
    #   end.flatten
    # end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redpomo-0.0.3 lib/redpomo/config.rb
redpomo-0.0.2 lib/redpomo/config.rb
redpomo-0.0.1 lib/redpomo/config.rb