Sha256: 596c4395a5b9351e65d4923b94e3a9f025d4d0e27c1c82d6088d34e7f86ddb5a

Contents?: true

Size: 503 Bytes

Versions: 4

Compression:

Stored size: 503 Bytes

Contents

module MotionPrime
  module HasStyleOptions
    def extract_font_from(options, prefix = nil)
      options ||= {}
      return options[:font] if options[:font].present?

      name_key = [prefix, 'font_name'].compact.join('_').to_sym
      size_key = [prefix, 'font_size'].compact.join('_').to_sym
      if options.slice(size_key, name_key).any?
        font_name = options[name_key] || :system
        font_size = options[size_key] || 14
        font_name.uifont(font_size)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-prime-1.0.7 motion-prime/helpers/has_style_options.rb
motion-prime-1.0.6 motion-prime/helpers/has_style_options.rb
motion-prime-1.0.5 motion-prime/helpers/has_style_options.rb
motion-prime-1.0.4 motion-prime/helpers/has_style_options.rb