Sha256: 20c81fc3313b76981db2eaf8eef3b943c69cac2ab83b4763a62ca28fcc788ccc

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

module Love
  class Gem

    attr_reader :name, :authors, :plain_authors, :spec, :url

    def initialize(spec, fetch = true)
      @spec = spec
      @name = spec.name
      @plain_authors = spec.authors
      if spec.homepage.nil? or spec.homepage.empty?
        @url = "http://rubygems.org/gems/#{name}"
      else
        @url = spec.homepage
      end
      @authors = []
      fetch_authors if fetch
    end

    def fetch_authors
      plain_authors.each do |name|
        author = Love.authors.select { |a| a.name == name }.first
        if author
          add_author author
          author.add_gem self
        else
          person = Love::Author.new(name)
          person.add_gem self
          add_author person
          Love.authors << person
        end
      end
    end

    def add_author(author)
      @authors << author
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
share_some_love-0.1.4 lib/love/gem.rb
share_some_love-0.1.3 lib/love/gem.rb
share_some_love-0.1.2 lib/love/gem.rb
share_some_love-0.1.1 lib/love/gem.rb