Class: Modern::DSL::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/modern/dsl/info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, version) ⇒ Info

Returns a new instance of Info.



12
13
14
# File 'lib/modern/dsl/info.rb', line 12

def initialize(title, version)
  @value = Modern::Descriptor::Info.new(title: title, version: version)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/modern/dsl/info.rb', line 10

def value
  @value
end

Class Method Details

.build(title, version, &block) ⇒ Object



32
33
34
35
36
# File 'lib/modern/dsl/info.rb', line 32

def self.build(title, version, &block)
  i = Info.new(title, version)
  i.instance_exec(&block)
  i.value
end

Instance Method Details

#contact(name: nil, url: nil, email: nil) ⇒ Object



24
25
26
# File 'lib/modern/dsl/info.rb', line 24

def contact(name: nil, url: nil, email: nil)
  @value = @value.copy(contact: { name: name, url: url, email: email }.compact)
end

#description(v) ⇒ Object



16
17
18
# File 'lib/modern/dsl/info.rb', line 16

def description(v)
  @value = @value.copy(description: v)
end

#license(name, url: nil) ⇒ Object



28
29
30
# File 'lib/modern/dsl/info.rb', line 28

def license(name, url: nil)
  @value = @value.copy(license: { name: name, url: url }.compact)
end

#terms_of_service(v) ⇒ Object



20
21
22
# File 'lib/modern/dsl/info.rb', line 20

def terms_of_service(v)
  @value = @value.copy(terms_of_service: v)
end