Module: Breathing

Defined in:
lib/breathing.rb,
lib/breathing/cli.rb,
lib/breathing/excel.rb,
lib/breathing/trigger.rb,
lib/breathing/installer.rb,
lib/breathing/change_log.rb,
lib/breathing/terminal_table.rb

Defined Under Namespace

Classes: ChangeLog, Cli, Excel, Installer, TerminalTable, Trigger, UnsupportedError

Constant Summary collapse

VERSION =
Gem.loaded_specs['breathing'].version.to_s

Class Method Summary collapse

Class Method Details

.clearObject



23
24
25
26
# File 'lib/breathing.rb', line 23

def clear
  ActiveRecord::Base.establish_connection
  Breathing::ChangeLog.delete_all
end

.exportObject



28
29
30
31
# File 'lib/breathing.rb', line 28

def export
  ActiveRecord::Base.establish_connection
  Breathing::Excel.new.create
end

.installObject



13
14
15
16
# File 'lib/breathing.rb', line 13

def install
  ActiveRecord::Base.establish_connection
  Breathing::Installer.new.install
end

.render_terminal_table(table_name:, id: 1) ⇒ Object



33
34
35
36
# File 'lib/breathing.rb', line 33

def render_terminal_table(table_name:, id: 1)
  ActiveRecord::Base.establish_connection
  puts Breathing::TerminalTable.new(table_name).render(id: id)
end

.tail_f(table_name:, id: 1) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/breathing.rb', line 38

def tail_f(table_name:, id: 1)
  ActiveRecord::Base.establish_connection
  table = Breathing::TerminalTable.new(table_name)

  loop do
    text = table.render(id: id)
    if text.present?
      puts text
      id = table.last_id + 1
    end
    sleep 5
  end
end

.uninstallObject



18
19
20
21
# File 'lib/breathing.rb', line 18

def uninstall
  ActiveRecord::Base.establish_connection
  Breathing::Installer.new.uninstall
end