Class: Naksh::Interfaces::Rbgtk::GtkRuBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/naksh/interfaces/gtk/io.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gtk_text_buffer) ⇒ GtkRuBuffer

Returns a new instance of GtkRuBuffer.



46
47
48
# File 'lib/naksh/interfaces/gtk/io.rb', line 46

def initialize gtk_text_buffer
  @buffer=gtk_text_buffer
end

Instance Attribute Details

#bufferObject

Returns the value of attribute buffer.



52
53
54
# File 'lib/naksh/interfaces/gtk/io.rb', line 52

def buffer
  @buffer
end

Instance Method Details

#pp(*a) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/naksh/interfaces/gtk/io.rb', line 63

def pp *a
  a.each do |arg|
    if arg.kind_of? Array
      arg.each do |el|
        buffer.insert(buffer.end_iter,(el[-1]=="\n" or el[-1].chr=="\n")? el : el+"\n")
      end
    elsif arg.kind_of? String
      buffer.insert buffer.end_iter,arg
    elsif arg.kind_of? Symbol
      buffer.insert buffer.end_iter,":#{arg.to_s}:"
    end
  end
end


55
56
57
58
59
60
# File 'lib/naksh/interfaces/gtk/io.rb', line 55

def print *a
  a.each do |str|
    buffer.insert buffer.end_iter,str
  end
  true
end