class ContributorsStats::Reader
Base for reading ContributorsStats
data
Attributes
data[R]
raw_data[R]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
ContributorsStats::Base::new
# File lib/contributors_stats/reader.rb, line 12 def initialize(options = {}) configure_path(*options.delete(:configure_path)) if options[:configure_path] super(options) @raw_data = [] @data = nil parse_readers(filter_options("reader")) end
Public Instance Methods
load(type, name)
click to toggle source
load data using given plugin @param type [String] plugin to use @param name [String] name to pass to the plugin
# File lib/contributors_stats/reader.rb, line 23 def load(type, name) reader_plugin(type).load(name) do |data, name| log "repository: #{name}" @raw_data += data end @data = nil end
Private Instance Methods
parse_readers(options = {})
click to toggle source
# File lib/contributors_stats/reader.rb, line 41 def parse_readers(options = {}) options.each do |type, name| if name.kind_of?(Array) name.each{|n| load(type,n)} else load(type, name) end end end
reader_plugin(type)
click to toggle source
# File lib/contributors_stats/reader.rb, line 33 def reader_plugin(type) plugin = plugins.first_class!("reader", type) if plugin.kind_of?(ContributorsStats::JsonHelper) plugin.send(:configure_path, path_prefix, path_suffix) end plugin end