Class: GBud::ProjectMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/gbud/project_metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProjectMetadata



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

#authorsObject

Returns the value of attribute authors.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def authors
  @authors
end

#descriptionObject

Returns the value of attribute description.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def description
  @description
end

#emailObject

Returns the value of attribute email.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def email
  @email
end

#licenseObject (readonly)

Returns the value of attribute license.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def license
  @license
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def name
  @name
end

#summaryObject

Returns the value of attribute summary.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def summary
  @summary
end

#urlObject

Returns the value of attribute url.



20
21
22
# File 'lib/gbud/project_metadata.rb', line 20

def url
  @url
end

#versionObject (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_hashObject



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: @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