Class: GBud::ProjectMetadata
- Inherits:
-
Object
- Object
- GBud::ProjectMetadata
- Defined in:
- lib/gbud/project_metadata.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#description ⇒ Object
Returns the value of attribute description.
-
#email ⇒ Object
Returns the value of attribute email.
-
#license ⇒ Object
readonly
Returns the value of attribute license.
-
#name ⇒ Object
Returns the value of attribute name.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize ⇒ ProjectMetadata
constructor
A new instance of ProjectMetadata.
- #to_hash ⇒ Object
- #validate_email(email) ⇒ Object
- #validate_name(name) ⇒ Object
- #validate_url(url) ⇒ Object
Constructor Details
#initialize ⇒ ProjectMetadata
29 30 31 32 |
# File 'lib/gbud/project_metadata.rb', line 29 def initialize @version = '0.0.1' @license = 'GPL-3.0' end |
Instance Attribute Details
#authors ⇒ Object
Returns the value of attribute authors.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def end |
#description ⇒ Object
Returns the value of attribute description.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def description @description end |
#email ⇒ Object
Returns the value of attribute email.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def email @email end |
#license ⇒ Object (readonly)
Returns the value of attribute license.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def license @license end |
#name ⇒ Object
Returns the value of attribute name.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def name @name end |
#summary ⇒ Object
Returns the value of attribute summary.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def summary @summary end |
#url ⇒ Object
Returns the value of attribute url.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
20 21 22 |
# File 'lib/gbud/project_metadata.rb', line 20 def version @version end |
Instance Method Details
#to_hash ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gbud/project_metadata.rb', line 58 def to_hash { name: @name, authors: , email: @email, url: @url, summary: @summary, description: @description, version: @version, license: @license } end |
#validate_email(email) ⇒ Object
75 76 77 |
# File 'lib/gbud/project_metadata.rb', line 75 def validate_email email /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i =~ email end |
#validate_name(name) ⇒ Object
71 72 73 |
# File 'lib/gbud/project_metadata.rb', line 71 def validate_name name /\A[a-z][a-z0-9_\-]*\Z/i =~ name end |
#validate_url(url) ⇒ Object
79 80 81 |
# File 'lib/gbud/project_metadata.rb', line 79 def validate_url url /https?:\/\/[\S]+/ =~ url end |