Class: Middleman::AsciiDoc::AuthorData
- Inherits:
-
Object
- Object
- Middleman::AsciiDoc::AuthorData
- Defined in:
- lib/middleman-asciidoc/extension.rb
Constant Summary collapse
- UrlWithUsernameRx =
/^(.+?)\[@([^\]]+)\]$/
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(name, email_or_url = nil) ⇒ AuthorData
constructor
A new instance of AuthorData.
Constructor Details
#initialize(name, email_or_url = nil) ⇒ AuthorData
Returns a new instance of AuthorData.
352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/middleman-asciidoc/extension.rb', line 352 def initialize name, email_or_url = nil @name = name if email_or_url if email_or_url.start_with? 'https://', 'http://' if (email_or_url.include? '[') && UrlWithUsernameRx =~ email_or_url @url, @username = $1, $2 else @url = email_or_url end else @email = email_or_url end end end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
350 351 352 |
# File 'lib/middleman-asciidoc/extension.rb', line 350 def email @email end |
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
350 351 352 |
# File 'lib/middleman-asciidoc/extension.rb', line 350 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
350 351 352 |
# File 'lib/middleman-asciidoc/extension.rb', line 350 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
350 351 352 |
# File 'lib/middleman-asciidoc/extension.rb', line 350 def username @username end |