Sha256: c7142fac5be996f229f7e008c11be9f460137d113a12fe43c667e78e39ce3843

Contents?: true

Size: 1.77 KB

Versions: 7

Compression:

Stored size: 1.77 KB

Contents

module Fontist
  module Utils
    module Dsl
      def key(key)
        instance.key = key
      end

      def desc(description)
        instance.description = description
      end

      def homepage(homepage)
        instance.homepage = homepage
      end

      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

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

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

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

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

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

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

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

      def test
      end

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

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

      def license_url(url)
        instance.license_url = url
      end

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

Version data entries

7 entries across 6 versions & 2 rubygems

Version Path
fontist-1.3.0 lib/fontist/utils/dsl.rb
fontist-1.2.1 lib/fontist/utils/dsl.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/fontist-1.1.0/lib/fontist/utils/dsl.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/fontist-1.2.0/lib/fontist/utils/dsl.rb
fontist-1.2.0 lib/fontist/utils/dsl.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/fontist-1.1.0/lib/fontist/utils/dsl.rb
fontist-1.1.0 lib/fontist/utils/dsl.rb