class Symbol::Decoration
Attributes
decorator_options[RW]
Public Class Methods
register(*decorators)
click to toggle source
# File lib/symbol_decoration.rb, line 8 def self.register(*decorators) options = decorators.last.is_a?(Hash) ? decorators.pop : {} decorators.map(&:to_sym).each do |decorator| self.decorator_options[decorator] = (self.decorator_options[decorator] || {}).merge(options) klass = self.decorator_options[decorator][:chainable] ? ChainableDecoration : Decoration Extensions.module_eval do define_method(decorator) do |*args, &block| klass.new(self, decorator, args, block) end end end end
Public Instance Methods
inspect()
click to toggle source
# File lib/symbol_decoration.rb, line 21 def inspect s = "#{symbol.inspect}.#{decorator}" _args = block ? args + [block] : args s += "(#{_args.map(&:inspect).join(", ")})" unless _args.empty? s end
Also aliased as: to_s