Class: Gtk::TreeIter

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/vendor/json_pure/lib/json/editor.rb

Overview

The Gtk::TreeIter class is reopened and some auxiliary methods are added.

Instance Method Summary collapse

Methods included from Enumerable

#to_json

Instance Method Details

#contentObject

Returns the content of this node.



195
196
197
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 195

def content
  self[CONTENT_COL]
end

#content=(value) ⇒ Object

Sets the content of this node to value.



200
201
202
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 200

def content=(value)
  self[CONTENT_COL] = value
end

#eachObject

Traverse each of this Gtk::TreeIter instance’s children and yield to them.



161
162
163
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 161

def each
  n_children.times { |i| yield nth_child(i) }
end

#recursive_each {|_self| ... } ⇒ Object

Recursively traverse all nodes of this Gtk::TreeIter’s subtree (including self) and yield to them.

Yields:

  • (_self)

Yield Parameters:

  • _self (Gtk::TreeIter)

    the object that the method was called on



167
168
169
170
171
172
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 167

def recursive_each(&block)
  yield self
  each do |i|
    i.recursive_each(&block)
  end
end

#remove_subtree(model) ⇒ Object

Remove the subtree of this Gtk::TreeIter instance from the model model.



176
177
178
179
180
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 176

def remove_subtree(model)
  while current = first_child
    model.remove(current)
  end
end

#typeObject

Returns the type of this node.



183
184
185
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 183

def type
  self[TYPE_COL]
end

#type=(value) ⇒ Object

Sets the type of this node to value. This implies setting the respective icon accordingly.



189
190
191
192
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 189

def type=(value)
  self[TYPE_COL] = value
  self[ICON_COL] = Editor.fetch_icon(value)
end