Class: ClassSource::Declarations

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

Overview

A helper class for tracking class declaration points

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



4
5
6
7
# File 'lib/class_source/declarations.rb', line 4

def self.[](key)
  @declarations ||= {}
  @declarations[key]
end

.add(klass_name, locations) ⇒ Object



9
10
11
12
13
# File 'lib/class_source/declarations.rb', line 9

def self.add(klass_name, locations)
  @declarations ||= {}
  @declarations[klass_name] ||= []
  @declarations[klass_name] += locations
end

.save(declarations) ⇒ Object



15
16
17
18
19
# File 'lib/class_source/declarations.rb', line 15

def self.save(declarations)
  declarations.each do |klass_name, locations|
    add(klass_name, locations)
  end
end