Class: GBud::ProjectMetadata
- Inherits:
-
Object
- Object
- GBud::ProjectMetadata
- Defined in:
- lib/gbud/project_metadata.rb
Overview
ProjectMetadata
- Author
-
Richard Davis
- Copyright
-
Copyright 2017 Richard Davis
- License
-
GNU Public License 3
The means by which user input describing project metadata is captured to be used by GBud::ProjectBuilder objects.
Instance Attribute Summary collapse
-
#authors ⇒ Object
List of the project authors.
-
#description ⇒ Object
A longer description of the project.
-
#email ⇒ Object
Email address for project.
-
#license ⇒ Object
readonly
The project license (defaults to GPL-3.0).
-
#name ⇒ Object
The name of the project.
-
#summary ⇒ Object
A short project summary.
-
#url ⇒ Object
The URL for project.
-
#version ⇒ Object
readonly
The project version (defaults to 0.0.1).
Instance Method Summary collapse
-
#initialize ⇒ ProjectMetadata
constructor
Instantiates a ProjectMetadata object.
-
#to_hash ⇒ Object
Returns the object attributes as a hash.
-
#validate_email(email) ⇒ Object
Validates that the given email meets criteria.
-
#validate_name(name) ⇒ Object
Validates that the given name meets criteria.
-
#validate_url(url) ⇒ Object
Validates that the given url meets criteria.
Constructor Details
#initialize ⇒ ProjectMetadata
Instantiates a ProjectMetadata object
47 48 49 50 |
# File 'lib/gbud/project_metadata.rb', line 47 def initialize @version = '0.0.1' @license = 'GPL-3.0' end |
Instance Attribute Details
#authors ⇒ Object
List of the project authors
35 36 37 |
# File 'lib/gbud/project_metadata.rb', line 35 def end |
#description ⇒ Object
A longer description of the project
33 34 35 |
# File 'lib/gbud/project_metadata.rb', line 33 def description @description end |
#email ⇒ Object
Email address for project
37 38 39 |
# File 'lib/gbud/project_metadata.rb', line 37 def email @email end |
#license ⇒ Object (readonly)
The project license (defaults to GPL-3.0)
43 44 45 |
# File 'lib/gbud/project_metadata.rb', line 43 def license @license end |
#name ⇒ Object
The name of the project
29 30 31 |
# File 'lib/gbud/project_metadata.rb', line 29 def name @name end |
#summary ⇒ Object
A short project summary
31 32 33 |
# File 'lib/gbud/project_metadata.rb', line 31 def summary @summary end |
#url ⇒ Object
The URL for project
39 40 41 |
# File 'lib/gbud/project_metadata.rb', line 39 def url @url end |
#version ⇒ Object (readonly)
The project version (defaults to 0.0.1)
41 42 43 |
# File 'lib/gbud/project_metadata.rb', line 41 def version @version end |
Instance Method Details
#to_hash ⇒ Object
Returns the object attributes as a hash
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/gbud/project_metadata.rb', line 78 def to_hash { name: @name, authors: , email: @email, url: @url, summary: @summary, description: @description, version: @version, license: @license } end |
#validate_email(email) ⇒ Object
Validates that the given email meets criteria
99 100 101 |
# File 'lib/gbud/project_metadata.rb', line 99 def validate_email(email) /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i =~ email end |
#validate_name(name) ⇒ Object
Validates that the given name meets criteria
93 94 95 |
# File 'lib/gbud/project_metadata.rb', line 93 def validate_name(name) /\A[a-z][a-z0-9_\-]*\Z/i =~ name end |
#validate_url(url) ⇒ Object
Validates that the given url meets criteria
105 106 107 |
# File 'lib/gbud/project_metadata.rb', line 105 def validate_url(url) %r{https?:\/\/[\S]+} =~ url end |