Class: Gem::Author

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubygems/author.rb,
lib/rubygems/author/version.rb

Overview

# Gem Author

This class holds authors info to be used primarily in gem specs.

## Usage

  1. Inherit Gem::Author inside your gem and add the authors’ info.

Example:

module MyLib
  class Author < Gem::Author
    new(
      name:   'Your Name',
      email:  'Your.Name@email.service',
      github: 'Your-GitHub-Username',
    )
  end
end
  1. You can call some helper methods now.

Example:

Gem::Specification.new do |spec|
  spec.name     = 'my_lib'
  spec.version  = MyLib::VERSION
  spec.authors  = MyLib::Author.names
  spec.email    = MyLib::Author.emails
  spec.homepage = "#{MyLib::Author.github_url}/#{spec.name}"
end

Direct Known Subclasses

Author

Defined Under Namespace

Modules: ClassMethods Classes: Author

Constant Summary collapse

VERSION =
'0.1.2'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email

Returns:

  • (Object)

    the current value of email



36
37
38
# File 'lib/rubygems/author.rb', line 36

def email
  @email
end

#githubObject

Returns the value of attribute github

Returns:

  • (Object)

    the current value of github



36
37
38
# File 'lib/rubygems/author.rb', line 36

def github
  @github
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



36
37
38
# File 'lib/rubygems/author.rb', line 36

def name
  @name
end

Class Method Details

.inherited(child) ⇒ Object



41
42
43
44
45
# File 'lib/rubygems/author.rb', line 41

def self.inherited child
	super

	child.extend ClassMethods
end

Instance Method Details

#github_urlObject



55
# File 'lib/rubygems/author.rb', line 55

def github_url = github && "https://github.com/#{github}"