Class: RailsDb::History

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_db/history.rb

Class Method Summary collapse

Class Method Details

.add(sql) ⇒ Object



10
11
12
# File 'lib/rails_db/history.rb', line 10

def add(sql)
  instance.push(sql) unless last == sql
end

.historyObject



22
23
24
# File 'lib/rails_db/history.rb', line 22

def history
  instance.reverse
end

.instanceObject



6
7
8
# File 'lib/rails_db/history.rb', line 6

def instance
  $history ||= []
end

.lastObject



14
15
16
# File 'lib/rails_db/history.rb', line 14

def last
  history[0]
end

.remove(sql) ⇒ Object



18
19
20
# File 'lib/rails_db/history.rb', line 18

def remove(sql)
  instance.delete(sql)
end