Class: Ronin::Core::Metadata::Authors::Author
- Inherits:
-
Object
- Object
- Ronin::Core::Metadata::Authors::Author
- Defined in:
- lib/ronin/core/metadata/authors/author.rb
Overview
Represents author metadata.
Instance Attribute Summary collapse
-
#blog ⇒ String?
readonly
The author's blog.
-
#discord ⇒ String?
readonly
The author's Discord handle.
-
#email ⇒ String?
readonly
The author's email.
-
#github ⇒ String?
readonly
The author's GitHub user name.
-
#gitlab ⇒ String?
readonly
The author's GitLab user name.
-
#mastodon ⇒ String?
readonly
The author's Mastodon handle.
-
#name ⇒ String
readonly
The author's name.
-
#pgp ⇒ String?
readonly
The author's PGP Key ID.
-
#twitter ⇒ String?
readonly
The author's Twitter handle.
-
#website ⇒ String?
readonly
The author's website.
Instance Method Summary collapse
-
#blog? ⇒ Boolean
Determines if the author has a #blog set.
-
#discord? ⇒ Boolean
Determines if the author has a #discord handle set.
-
#email? ⇒ Boolean
Determines if the author has an #email set.
-
#github? ⇒ Boolean
Determines if the author has a #github user name set.
-
#github_url ⇒ String?
Returns the URL to the author's GitHub profile.
-
#gitlab? ⇒ Boolean
Determines if the author has a #gitlab user name set.
-
#gitlab_url ⇒ String?
Returns the URL to the author's GitLab profile.
-
#initialize(name, email: nil, pgp: nil, website: nil, blog: nil, github: nil, gitlab: nil, twitter: nil, mastodon: nil, discord: nil) ⇒ Author
constructor
Initializes the author.
-
#mastodon? ⇒ Boolean
Determines if the author has a #mastodon handle set.
-
#mastodon_url ⇒ String?
Returns the URL to the author's Mastodon profile.
-
#pgp? ⇒ Boolean
Determines if the author has a #pgp Key ID set.
-
#to_s ⇒ String
Converts the author to a String.
-
#twitter? ⇒ Boolean
Determines if the author has a #twitter handle set.
-
#twitter_url ⇒ String?
Returns the URL to the author's Twitter profile.
-
#website? ⇒ Boolean
Determines if the author has a #website set.
Constructor Details
#initialize(name, email: nil, pgp: nil, website: nil, blog: nil, github: nil, gitlab: nil, twitter: nil, mastodon: nil, discord: nil) ⇒ Author
Initializes the author.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 113 def initialize(name, email: nil, pgp: nil, website: nil, blog: nil, github: nil, gitlab: nil, twitter: nil, mastodon: nil, discord: nil) @name = name @email = email @pgp = pgp @website = website @blog = blog @github = github @gitlab = gitlab @twitter = twitter @mastodon = mastodon @discord = discord end |
Instance Attribute Details
#blog ⇒ String? (readonly)
The author's blog.
51 52 53 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 51 def blog @blog end |
#discord ⇒ String? (readonly)
The author's Discord handle.
78 79 80 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 78 def discord @discord end |
#email ⇒ String? (readonly)
The author's email.
36 37 38 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 36 def email @email end |
#github ⇒ String? (readonly)
The author's GitHub user name.
56 57 58 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 56 def github @github end |
#gitlab ⇒ String? (readonly)
The author's GitLab user name.
61 62 63 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 61 def gitlab @gitlab end |
#mastodon ⇒ String? (readonly)
The author's Mastodon handle.
73 74 75 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 73 def mastodon @mastodon end |
#name ⇒ String (readonly)
The author's name.
31 32 33 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 31 def name @name end |
#pgp ⇒ String? (readonly)
The author's PGP Key ID.
41 42 43 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 41 def pgp @pgp end |
#twitter ⇒ String? (readonly)
The author's Twitter handle.
66 67 68 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 66 def twitter @twitter end |
#website ⇒ String? (readonly)
The author's website
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.
167 168 169 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 167 def blog? @blog != nil end |
#discord? ⇒ Boolean
Determines if the author has a #discord handle set.
214 215 216 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 214 def discord? @discord != nil end |
#email? ⇒ Boolean
Determines if the author has an #email set.
140 141 142 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 140 def email? @email != nil end |
#github? ⇒ Boolean
Determines if the author has a #github user name set.
176 177 178 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 176 def github? @github != nil end |
#github_url ⇒ String?
Returns the URL to the author's GitHub profile.
225 226 227 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 225 def github_url "https://github.com/#{@github.sub(/\A@/,'')}" if @github end |
#gitlab? ⇒ Boolean
Determines if the author has a #gitlab user name set.
185 186 187 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 185 def gitlab? @gitlab != nil end |
#gitlab_url ⇒ String?
Returns the URL to the author's GitLab profile.
236 237 238 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 236 def gitlab_url "https://gitlab.com/#{@gitlab.sub(/\A@/,'')}" if @gitlab end |
#mastodon? ⇒ Boolean
Determines if the author has a #mastodon handle set.
205 206 207 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 205 def mastodon? @mastodon != nil end |
#mastodon_url ⇒ String?
Returns the URL to the author's Mastodon profile.
260 261 262 263 264 265 266 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 260 def mastodon_url if @mastodon username, host = @mastodon.sub(/\A@/,'').split('@',2) "https://#{host}/@#{username}" end end |
#pgp? ⇒ Boolean
Determines if the author has a #pgp Key ID set.
149 150 151 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 149 def pgp? @pgp != nil end |
#to_s ⇒ String
Converts the author to a String.
274 275 276 277 278 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 274 def to_s if @email then "#{@name} <#{@email}>" else @name end end |
#twitter? ⇒ Boolean
Determines if the author has a #twitter handle set.
194 195 196 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 194 def twitter? @twitter != nil end |
#twitter_url ⇒ String?
Returns the URL to the author's Twitter profile.
247 248 249 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 247 def twitter_url "https://twitter.com/#{@twitter.sub(/\A@/,'')}" if @twitter end |
#website? ⇒ Boolean
Determines if the author has a #website set.
158 159 160 |
# File 'lib/ronin/core/metadata/authors/author.rb', line 158 def website? @website != nil end |