class RubyDetective::SourceRepresentation::Query

Attributes

store[R]

Public Class Methods

new() click to toggle source
# File lib/ruby_detective/source_representation/query.rb, line 6
def initialize
  @store = DataStore.instance
end

Public Instance Methods

classes(where: {}) click to toggle source
# File lib/ruby_detective/source_representation/query.rb, line 23
def classes(where: {})
  classes = store.classes

  case
  when where.key?(:path)
    classes.select { |c| c.path == where[:path] }
  else
    classes
  end
end
constants(where: {}) click to toggle source
# File lib/ruby_detective/source_representation/query.rb, line 10
def constants(where: {})
  constants = store.constants

  case
  when where.key?(:refers_to)
    constants.select { |c| c.refers_to == where[:refers_to] }
  when where.key?(:caller)
    constants.select { |c| c.caller == where[:caller] }
  else
    constants
  end
end