Class: Dsx::Dml::Changeset

Inherits:
Object
  • Object
show all
Defined in:
lib/dsx/dml.rb

Instance Method Summary collapse

Constructor Details

#initialize(zone, id_num, writer = false) ⇒ Changeset

Returns a new instance of Changeset.



37
38
39
40
41
42
43
44
45
# File 'lib/dsx/dml.rb', line 37

def initialize(zone, id_num, writer = false)
  @id_num = id_num
  @zone = zone
  @stack = []
  if(writer)
    @writer = writer
  end
  start_command
end

Instance Method Details

#curl(writer = false) ⇒ Object

Alternative to Net::SFTP.



90
91
92
93
94
95
96
97
# File 'lib/dsx/dml.rb', line 90

def curl(writer = false)
  if (writer)
      writer.curl(to_string)
  elsif (@writer)
      @writer.curl(to_string)
  end
  return self
end

#net_sftp(writer = false) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/dsx/dml.rb', line 80

def net_sftp(writer = false)
  if (writer)
      writer.net_sftp(to_string)
  elsif (@writer)
      @writer.net_sftp(to_string)
  end
  return self
end

#stackObject



99
100
101
# File 'lib/dsx/dml.rb', line 99

def stack
  @stack
end

#table(table_name) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/dsx/dml.rb', line 47

def table(table_name)
  case table_name
  when :Cards
      return CardsTable.new(self, table_name)
  when :Names
      return NamesTable.new(self, table_name)
  when 'Cards'
      return CardsTable.new(self, table_name)
  when 'Names'
      return NamesTable.new(self, table_name)
  else
      return Table.new(self, table_name)
  end
end

#to_sObject



68
69
70
# File 'lib/dsx/dml.rb', line 68

def to_s
  to_string
end

#to_stringObject

Their system won’t work correctly with n, but will with r. It’d also be possible to change the record separator, but that seems like a worse idea.



64
65
66
# File 'lib/dsx/dml.rb', line 64

def to_string
  @stack.join("\r")
end

#writerObject



76
77
78
# File 'lib/dsx/dml.rb', line 76

def writer
  @writer
end

#writer=(writer) ⇒ Object



72
73
74
# File 'lib/dsx/dml.rb', line 72

def writer=(writer)
  @writer = writer
end