class BBS::Application::ThemeBuilder
DSL inside theme do ... end. A call named after a style role (one of BBS::Theme.roles) with one argument is a style override (e.g. screen "\e[0m").
Public Class Methods
Source
# File lib/bbs/application/builder.rb, line 239 def initialize(base) @base = base @overrides = {} end
Starts from base, a BBS::Theme, with no overrides.
Public Instance Methods
Source
# File lib/bbs/application/builder.rb, line 258 def build @overrides.empty? ? @base : @base.merge(@overrides) end
Returns the base theme, or a copy of it with the overrides merged in.
Source
# File lib/bbs/application/builder.rb, line 247 def inherit(theme) @base = Theme.fetch(theme) end
Replaces the base theme with theme, a BBS::Theme or the name of one of its presets (a Symbol such as :dosnavigator). Raises ArgumentError for an unknown name.
Source
# File lib/bbs/application/builder.rb, line 269 def method_missing(name, *args) return @overrides[name] = args.first if args.size == 1 && Theme.roles.include?(name) super end
Treats role value as style(role, value) for a style role of BBS::Theme.roles. Any other name, or another number of arguments, raises NoMethodError.
Calls superclass method
# File lib/bbs/application/builder.rb, line 264 def respond_to_missing?(name, include_private = false) = Theme.roles.include?(name) || super
True for the style roles (BBS::Theme.roles), the names method_missing takes.
Calls superclass method
Source
# File lib/bbs/application/builder.rb, line 253 def style(key, value) @overrides[key.to_sym] = value end
Overrides the style of role key with value, an SGR escape sequence.