class Dsx::Dml::Changeset

Public Class Methods

new(zone, id_num, writer = false) click to toggle source
# 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

Public Instance Methods

curl(writer = false) click to toggle source

Alternative to Net::SFTP.

# 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) click to toggle source
# 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
stack() click to toggle source
# File lib/dsx/dml.rb, line 99
def stack
  @stack
end
table(table_name) click to toggle source
# 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_s() click to toggle source
# File lib/dsx/dml.rb, line 68
def to_s
  to_string
end
to_string() click to toggle source

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.

# File lib/dsx/dml.rb, line 64
def to_string
  @stack.join("\r")
end
writer() click to toggle source
# File lib/dsx/dml.rb, line 76
def writer
  @writer
end
writer=(writer) click to toggle source
# File lib/dsx/dml.rb, line 72
def writer=(writer)
  @writer = writer
end

Private Instance Methods

start_command() click to toggle source
# File lib/dsx/dml.rb, line 105
def start_command
  @stack << "I L#{@zone.location_num} U#{@zone.udf_field_num} ^#{@id_num}^^^"
end