Sha256: 63616e6bf2a4bc179776a89fd9a8f8bab9a6a83a622fd458c26bdf061b5cdf25

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

module Stickler
  #
  # A lightweight version of a gemspec that only responds to name, version,
  # platform and full_name.  Many of the items in the rubygems world
  # deal with the triplet [ name, verison, platform ] and this class
  # encapsulates that.
  #
  class SpecLite
    attr_reader :name
    attr_reader :version
    attr_reader :platform

    def initialize( name, version, platform )
      @name = name
      @version = version
      @new_platform = Gem::Platform.new( platform )
      @platform = platform
    end

    def full_name
      if platform == Gem::Platform::RUBY or platform.nil? then
        "#{name}-#{version}"
      else
        "#{name}-#{version}-#{platform}"
      end
    end

    def name_version
      "#{name}-#{version}"
    end

    def to_a
      [ name, version, platform.to_s ]
    end

    def to_s
      full_name
    end
  end
end

module Gem
  class Specification
    def name_version
      "#{name}-#{version}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stickler-0.1.0 lib/stickler/spec_lite.rb
stickler-0.1.1 lib/stickler/spec_lite.rb