Class: ClassSource::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/class_source/index.rb

Instance Method Summary collapse

Constructor Details

#initialize(target_class, options = {}) ⇒ Index

Returns a new instance of Index.



3
4
5
6
# File 'lib/class_source/index.rb', line 3

def initialize(target_class, options = {})
  @target_class = target_class
  @options = options
end

Instance Method Details

#==(value) ⇒ Object



12
13
14
# File 'lib/class_source/index.rb', line 12

def ==(value)
  to_s == value
end

#all(options = {}) ⇒ Object



16
17
18
# File 'lib/class_source/index.rb', line 16

def all(options={})
  @collator ||= Collator.new(@target_class, self).to_hash(options)
end

#class_methodsObject



28
29
30
# File 'lib/class_source/index.rb', line 28

def class_methods
  methods.klass
end

#filesObject



36
37
38
# File 'lib/class_source/index.rb', line 36

def files
  locator.files
end

#locations(options = {}) ⇒ Object



20
21
22
# File 'lib/class_source/index.rb', line 20

def locations(options={})
  locator.to_a
end

#locatorObject



32
33
34
# File 'lib/class_source/index.rb', line 32

def locator
  @locator ||= Locator.new(@target_class, @options)
end

#methodsObject



24
25
26
# File 'lib/class_source/index.rb', line 24

def methods
  @method_details ||= MethodIndex.new(@target_class)
end

#to_s(options = {}) ⇒ Object



8
9
10
# File 'lib/class_source/index.rb', line 8

def to_s(options={})
  all(options).values.join("")
end