Putting together a global set method for defaults
This commit is contained in:
@@ -6,12 +6,28 @@ module Squib
|
||||
# Setting a hint to nil or to :off will disable hints. @see samples/text.rb
|
||||
#
|
||||
# @param [Color] text the color of the text hint. To turn off use nil or :off. @see API.md
|
||||
# @return nil
|
||||
# @return [nil] Returns nothing
|
||||
# @api public
|
||||
def hint(text: nil)
|
||||
text = nil if text == :off
|
||||
@text_hint = text
|
||||
end
|
||||
|
||||
# Sets various defaults for this deck. Defaults can be overriden by the commands themselves
|
||||
# @example
|
||||
# set font: 'Arial 26'
|
||||
# text 'blah' # in Arial 26
|
||||
# text 'blah24', font: 'Arial 24' # in Arial 24
|
||||
# set font: :default # Back to Squib-wide default
|
||||
#
|
||||
# @param opts: the hash of options.
|
||||
# @option font: the font string to set as default. Can also be set to `:default` to use the Squib-wide default.
|
||||
# @return [nil] Returns nothing
|
||||
# @api public
|
||||
def set(opts = {})
|
||||
opts = needs(opts, [:font])
|
||||
@font = opts[:font]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
module Squib
|
||||
class Deck
|
||||
|
||||
# @api private todo
|
||||
def font(type: 'Arial', size: 12, **options)
|
||||
raise 'Not implemented!'
|
||||
end
|
||||
|
||||
# @api private todo
|
||||
def set_font(type: 'Arial', size: 12, **options)
|
||||
raise 'Not implemented!'
|
||||
end
|
||||
|
||||
# Renders a string at a given location, width, alignment, font, etc.
|
||||
# Unix-like newlines are interpreted even on Windows.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user