Class: Caracal::Core::Models::FontModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/caracal/core/models/font_model.rb

Overview

This class encapsulates the logic needed to store and manipulate font data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#initialize

Constructor Details

This class inherits a constructor from Caracal::Core::Models::BaseModel

Instance Attribute Details

#font_nameObject (readonly)

accessors



18
19
20
# File 'lib/caracal/core/models/font_model.rb', line 18

def font_name
  @font_name
end

Instance Method Details

#matches?(str) ⇒ Boolean

STATE ================================

Returns:

  • (Boolean)


38
39
40
# File 'lib/caracal/core/models/font_model.rb', line 38

def matches?(str)
  font_name.to_s.downcase == str.to_s.downcase
end

#valid?Boolean

VALIDATION ===========================

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/caracal/core/models/font_model.rb', line 45

def valid?
  a = [:name]
  a.map { |m| send("font_#{ m }") }.compact.size == a.size
end