Class: Ronin::Core::Metadata::Authors::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/core/metadata/authors/author.rb

Overview

Represents author metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, email: nil, pgp: nil, website: nil, blog: nil, github: nil, gitlab: nil, twitter: nil, discord: nil) ⇒ Author

Initializes the author.

Parameters:

  • name (String)

    The author's name.

  • email (String, nil) (defaults to: nil)

    The author's email.

  • pgp (String, nil) (defaults to: nil)

    The author's PGP Key ID.

  • website (String, nil) (defaults to: nil)

    The author's website.

  • blog (String, nil) (defaults to: nil)

    The author's blog.

  • github (String, nil) (defaults to: nil)

    The author's GitHub user name.

  • gitlab (String, nil) (defaults to: nil)

    The author's GitLab user name.

  • twitter (String, nil) (defaults to: nil)

    The author's Twitter handle.

  • discord (String, nil) (defaults to: nil)

    The author's Discord handle.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/ronin/core/metadata/authors/author.rb', line 103

def initialize(name, email:   nil,
                     pgp:     nil,
                     website: nil,
                     blog:    nil,
                     github:  nil,
                     gitlab:  nil,
                     twitter: nil,
                     discord: nil)
  @name  = name
  @email = email
  @pgp   = pgp

  @website = website
  @blog    = blog
  @github  = github
  @gitlab  = gitlab
  @twitter = twitter
  @discord = discord
end

Instance Attribute Details

#blogString? (readonly)

The author's blog.

Returns:

  • (String, nil)


51
52
53
# File 'lib/ronin/core/metadata/authors/author.rb', line 51

def blog
  @blog
end

#discordString? (readonly)

The author's Discord handle.

Returns:

  • (String, nil)


71
72
73
# File 'lib/ronin/core/metadata/authors/author.rb', line 71

def discord
  @discord
end

#emailString? (readonly)

The author's email.

Returns:

  • (String, nil)


36
37
38
# File 'lib/ronin/core/metadata/authors/author.rb', line 36

def email
  @email
end

#githubString? (readonly)

The author's GitHub user name.

Returns:

  • (String, nil)


56
57
58
# File 'lib/ronin/core/metadata/authors/author.rb', line 56

def github
  @github
end

#gitlabString? (readonly)

The author's GitLab user name.

Returns:

  • (String, nil)


61
62
63
# File 'lib/ronin/core/metadata/authors/author.rb', line 61

def gitlab
  @gitlab
end

#nameString (readonly)

The author's name.

Returns:

  • (String)


31
32
33
# File 'lib/ronin/core/metadata/authors/author.rb', line 31

def name
  @name
end

#pgpString? (readonly)

The author's PGP Key ID.

Returns:

  • (String, nil)


41
42
43
# File 'lib/ronin/core/metadata/authors/author.rb', line 41

def pgp
  @pgp
end

#twitterString? (readonly)

The author's Twitter handle.

Returns:

  • (String, nil)


66
67
68
# File 'lib/ronin/core/metadata/authors/author.rb', line 66

def twitter
  @twitter
end

#websiteString? (readonly)

The author's website

Returns:

  • (String, nil)


46
47
48
# File 'lib/ronin/core/metadata/authors/author.rb', line 46

def website
  @website
end

Instance Method Details

#blog?Boolean

Determines if the author has a #blog set.

Returns:

  • (Boolean)


155
156
157
# File 'lib/ronin/core/metadata/authors/author.rb', line 155

def blog?
  @blog != nil
end

#discord?Boolean

Determines if the author has a #discord handle set.

Returns:

  • (Boolean)


191
192
193
# File 'lib/ronin/core/metadata/authors/author.rb', line 191

def discord?
  @discord != nil
end

#email?Boolean

Determines if the author has an #email set.

Returns:

  • (Boolean)


128
129
130
# File 'lib/ronin/core/metadata/authors/author.rb', line 128

def email?
  @email != nil
end

#github?Boolean

Determines if the author has a #github user name set.

Returns:

  • (Boolean)


164
165
166
# File 'lib/ronin/core/metadata/authors/author.rb', line 164

def github?
  @github != nil
end

#github_urlString?

Returns the URL to the author's GitHub profile.

Returns:

  • (String, nil)

    Returns the URL to the author's GitHub profile, or nil if no #github user name has been set.



202
203
204
# File 'lib/ronin/core/metadata/authors/author.rb', line 202

def github_url
  "https://github.com/#{@github.sub(/\A@/,'')}" if @github
end

#gitlab?Boolean

Determines if the author has a #gitlab user name set.

Returns:

  • (Boolean)


173
174
175
# File 'lib/ronin/core/metadata/authors/author.rb', line 173

def gitlab?
  @gitlab != nil
end

#gitlab_urlString?

Returns the URL to the author's GitLab profile.

Returns:

  • (String, nil)

    Returns the URL to the author's GitLab profile, or nil if no #gitlab user name has been set.



213
214
215
# File 'lib/ronin/core/metadata/authors/author.rb', line 213

def gitlab_url
  "https://gitlab.com/#{@gitlab.sub(/\A@/,'')}" if @gitlab
end

#pgp?Boolean

Determines if the author has a #pgp Key ID set.

Returns:

  • (Boolean)


137
138
139
# File 'lib/ronin/core/metadata/authors/author.rb', line 137

def pgp?
  @pgp != nil
end

#to_sString

Converts the author to a String.

Returns:

  • (String)

    The author's name and/or email.



234
235
236
237
238
# File 'lib/ronin/core/metadata/authors/author.rb', line 234

def to_s
  if @email then "#{@name} <#{@email}>"
  else           @name
  end
end

#twitter?Boolean

Determines if the author has a #twitter handle set.

Returns:

  • (Boolean)


182
183
184
# File 'lib/ronin/core/metadata/authors/author.rb', line 182

def twitter?
  @twitter != nil
end

#twitter_urlString?

Returns the URL to the author's Twitter profile.

Returns:

  • (String, nil)

    Returns the URL to the author's Twitter profile, or nil if no #twitter user name has been set.



224
225
226
# File 'lib/ronin/core/metadata/authors/author.rb', line 224

def twitter_url
  "https://twitter.com/#{@twitter.sub(/\A@/,'')}" if @twitter
end

#website?Boolean

Determines if the author has a #website set.

Returns:

  • (Boolean)


146
147
148
# File 'lib/ronin/core/metadata/authors/author.rb', line 146

def website?
  @website != nil
end