Sha256: a9edbc8d61bf6d1ac76a684d5c02392041180ea39d41cac19c254b052b989101

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

module Fontist
  module Utils
    module Dsl
      class Font
        REQUIRED_ATTRIBUTES = %i[family_name
                                 style
                                 full_name
                                 filename].freeze

        attr_reader :attributes

        def initialize(attributes)
          REQUIRED_ATTRIBUTES.each do |required_attribute|
            unless attributes[required_attribute]
              raise(Fontist::Errors::MissingAttributeError.new(
                      "Missing attribute: #{required_attribute}"
                    ))
            end
          end

          self.attributes = attributes
        end

        def attributes=(attrs)
          @attributes = { family_name: attrs[:family_name],
                          type: attrs[:style],
                          full_name: attrs[:full_name],
                          post_script_name: attrs[:post_script_name],
                          version: attrs[:version],
                          description: attrs[:description],
                          copyright: attrs[:copyright],
                          font: attrs[:filename] }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fontist-1.6.0 lib/fontist/utils/dsl/font.rb
fontist-1.5.1 lib/fontist/utils/dsl/font.rb
fontist-1.5.0 lib/fontist/utils/dsl/font.rb
fontist-1.4.0 lib/fontist/utils/dsl/font.rb