module Tangle::Currify::ClassMethods

Class method extensions for currification of instance methods

Public Instance Methods

class.currified_methods(tag) → Array of Symbol click to toggle source

Return a list of currified methods for a given tag.

# File lib/tangle/currify.rb, line 23
def currified_methods(tag)
  mine = @currified_methods&.[](tag) || []
  return mine unless superclass.respond_to?(:currified_methods)

  superclass.currified_methods(tag) + mine
end

Private Instance Methods

class X click to toggle source
currify :tag, :method

Add a symbol to the list of currified methods for a tag.

# File lib/tangle/currify.rb, line 37
def currify(tag, method)
  raise CurrifyError if instance_method(method).arity.zero?

  @currified_methods ||= {}
  @currified_methods[tag] ||= []
  @currified_methods[tag] << method
end