module FindRefined

Constants

VERSION

Public Class Methods

find(mod, type) click to toggle source
# File lib/find_refined/finder.rb, line 3
def find mod, type
  refined_methods = []
  mod.module_eval do
    refine type do
      refined_methods = instance_methods(false)
    end
  end
  refined_methods
end
find_ancestors(mod, type) click to toggle source
# File lib/find_refined/finder.rb, line 14
def find_ancestors mod, type
  refined_methods = {}
  val = type.new
  val.class.ancestors.each do |ancestor|
    refined_methods[ancestor] = find(mod, ancestor)
  end
  refined_methods
end
find_basic(mod) click to toggle source
# File lib/find_refined/finder.rb, line 24
def find_basic mod
  refined_methods = {}
  [NilClass, Symbol, Numeric, String, Array, Hash, Range].each do |type|
    refined_methods[type] = find(mod, type)
  end
  refined_methods
end

Private Instance Methods

find(mod, type) click to toggle source
# File lib/find_refined/finder.rb, line 3
def find mod, type
  refined_methods = []
  mod.module_eval do
    refine type do
      refined_methods = instance_methods(false)
    end
  end
  refined_methods
end
find_ancestors(mod, type) click to toggle source
# File lib/find_refined/finder.rb, line 14
def find_ancestors mod, type
  refined_methods = {}
  val = type.new
  val.class.ancestors.each do |ancestor|
    refined_methods[ancestor] = find(mod, ancestor)
  end
  refined_methods
end
find_basic(mod) click to toggle source
# File lib/find_refined/finder.rb, line 24
def find_basic mod
  refined_methods = {}
  [NilClass, Symbol, Numeric, String, Array, Hash, Range].each do |type|
    refined_methods[type] = find(mod, type)
  end
  refined_methods
end