Module: Fontist::Utils::Dsl

Defined in:
lib/fontist/utils/dsl.rb,
lib/fontist/utils/dsl/font.rb,
lib/fontist/utils/dsl/collection_font.rb

Defined Under Namespace

Classes: CollectionFont, Font

Instance Method Summary collapse

Instance Method Details



72
73
74
# File 'lib/fontist/utils/dsl.rb', line 72

def copyright(copyright)
  instance.copyright = copyright
end

#desc(description) ⇒ Object



8
9
10
# File 'lib/fontist/utils/dsl.rb', line 8

def desc(description)
  instance.description = description
end

#display_progress_bar(value) ⇒ Object



80
81
82
# File 'lib/fontist/utils/dsl.rb', line 80

def display_progress_bar(value )
  instance.options = (instance.options || {}).merge(progress_bar: value )
end

#file_size(file_size) ⇒ Object



36
37
38
# File 'lib/fontist/utils/dsl.rb', line 36

def file_size(file_size)
  instance.temp_resource.merge!(file_size: file_size )
end

#filename(name) ⇒ Object



46
47
48
# File 'lib/fontist/utils/dsl.rb', line 46

def filename(name)
  instance.temp_resource.merge!(filename: name)
end

#homepage(homepage) ⇒ Object



12
13
14
# File 'lib/fontist/utils/dsl.rb', line 12

def homepage(homepage)
  instance.homepage = homepage
end

#key(key) ⇒ Object



4
5
6
# File 'lib/fontist/utils/dsl.rb', line 4

def key(key)
  instance.key = key
end

#license_url(url) ⇒ Object



76
77
78
# File 'lib/fontist/utils/dsl.rb', line 76

def license_url(url)
  instance.license_url = url
end

#open_license(license) ⇒ Object



67
68
69
70
# File 'lib/fontist/utils/dsl.rb', line 67

def open_license(license)
  instance.license = license
  instance.license_required = false
end

#provides_font(font, options = {}) ⇒ Object



54
55
56
57
# File 'lib/fontist/utils/dsl.rb', line 54

def provides_font(font, options = {})
  font_styles = instance.extract_font_styles(options)
  instance.font_list.push(name: font, styles: font_styles)
end

#provides_font_collection(name = nil) {|block| ... } ⇒ Object

Yields:

  • (block)


40
41
42
43
44
# File 'lib/fontist/utils/dsl.rb', line 40

def provides_font_collection(name = nil, &block)
  instance.temp_resource = {}
  yield(block) if block_given?
  instance.temp_resource = {}
end

#requires_license_agreement(license) ⇒ Object



62
63
64
65
# File 'lib/fontist/utils/dsl.rb', line 62

def requires_license_agreement(license)
  instance.license = license
  instance.license_required = true
end

#resource(resource_name) {|block| ... } ⇒ Object

Yields:

  • (block)


16
17
18
19
20
21
22
# File 'lib/fontist/utils/dsl.rb', line 16

def resource(resource_name, &block)
  instance.resources[resource_name] ||= {}
  instance.temp_resource = instance.resources[resource_name]

  yield(block) if block_given?
  instance.temp_resource = {}
end

#sha256(sha256) ⇒ Object



32
33
34
# File 'lib/fontist/utils/dsl.rb', line 32

def sha256(sha256)
  instance.temp_resource.merge!(sha256: sha256)
end

#source_filename(name) ⇒ Object



50
51
52
# File 'lib/fontist/utils/dsl.rb', line 50

def source_filename(name)
  instance.temp_resource.merge!(source_filename: name)
end

#testObject



59
60
# File 'lib/fontist/utils/dsl.rb', line 59

def test
end

#url(url) ⇒ Object



24
25
26
# File 'lib/fontist/utils/dsl.rb', line 24

def url(url)
  instance.temp_resource.merge!(urls: [url])
end

#urls(urls = []) ⇒ Object



28
29
30
# File 'lib/fontist/utils/dsl.rb', line 28

def urls(urls = [])
  instance.temp_resource.merge!(urls: urls)
end