Class: Phew::FontRepository
- Inherits:
-
Object
- Object
- Phew::FontRepository
- Defined in:
- lib/phew/font_repository.rb
Overview
Cache for font information retrieved from a Pango context
Instance Method Summary collapse
-
#get_font(text_description) ⇒ Object
Retrieve a font based on the given text description.
-
#initialize(context) ⇒ FontRepository
constructor
A new instance of FontRepository.
Constructor Details
#initialize(context) ⇒ FontRepository
Returns a new instance of FontRepository.
9 10 11 12 |
# File 'lib/phew/font_repository.rb', line 9 def initialize(context) @store = {} @context = context end |
Instance Method Details
#get_font(text_description) ⇒ Object
Retrieve a font based on the given text description. The text description should be in the format accepted by Font#new.
18 19 20 |
# File 'lib/phew/font_repository.rb', line 18 def get_font(text_description) @store[text_description] ||= Font.new @context, text_description end |