Sha256: 6bdd5cc7736986a5789db974d73e3a2d8fee52bbc43c9701b3d0f235a33c1bb6

Contents?: true

Size: 1.6 KB

Versions: 39

Compression:

Stored size: 1.6 KB

Contents

require 'caracal/core/models/base_model'


module Caracal
  module Core
    module Models
      
      # This class encapsulates the logic needed to store and manipulate
      # font data.
      #
      class FontModel < BaseModel
        
        #-------------------------------------------------------------
        # Configuration
        #-------------------------------------------------------------
        
        # accessors
        attr_reader :font_name
        
        
        
        #-------------------------------------------------------------
        # Public Instance Methods
        #-------------------------------------------------------------
    
        #=============== SETTERS ==============================
        
        # strings
        [:name].each do |m|
          define_method "#{ m }" do |value|
            instance_variable_set("@font_#{ m }", value.to_s)
          end
        end
        
        
        #=============== STATE ================================
        
        def matches?(str)
          font_name.to_s.downcase == str.to_s.downcase
        end
        
        
        #=============== VALIDATION ===========================
        
        def valid?
          a = [:name]
          a.map { |m| send("font_#{ m }") }.compact.size == a.size
        end
        
        
        #-------------------------------------------------------------
        # Private Instance Methods
        #-------------------------------------------------------------
        private
        
        def option_keys
          [:name]
        end
        
      end
      
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
caracal_the_curve-1.4.6 lib/caracal/core/models/font_model.rb
caracal_the_curve-1.4.5 lib/caracal/core/models/font_model.rb
caracal_the_curve-1.4.4 lib/caracal/core/models/font_model.rb
caracal_the_curve-1.4.3 lib/caracal/core/models/font_model.rb
caracal_the_curve-1.4.2 lib/caracal/core/models/font_model.rb
caracal_the_curve-1.4.1 lib/caracal/core/models/font_model.rb
caracal-1.4.1 lib/caracal/core/models/font_model.rb
caracal-1.4.0 lib/caracal/core/models/font_model.rb
caracal-1.3.0 lib/caracal/core/models/font_model.rb
caracal-1.2.0 lib/caracal/core/models/font_model.rb
caracal-1.1.2 lib/caracal/core/models/font_model.rb
caracal-1.1.1 lib/caracal/core/models/font_model.rb
caracal-1.1.0 lib/caracal/core/models/font_model.rb
caracal-1.0.13 lib/caracal/core/models/font_model.rb
caracal-1.0.12 lib/caracal/core/models/font_model.rb
caracal-1.0.11 lib/caracal/core/models/font_model.rb
caracal-1.0.10 lib/caracal/core/models/font_model.rb
caracal-1.0.9 lib/caracal/core/models/font_model.rb
caracal-1.0.8 lib/caracal/core/models/font_model.rb
caracal-1.0.7 lib/caracal/core/models/font_model.rb