Class: ObjectTable::StaticView

Inherits:
Object
  • Object
show all
Includes:
ViewMethods
Defined in:
lib/object_table/static_view.rb

Direct Known Subclasses

Group

Constant Summary

Constants included from TableMethods

TableMethods::Util

Instance Attribute Summary collapse

Attributes included from TableMethods

#R

Instance Method Summary collapse

Methods included from ViewMethods

#nrows, #pop_column

Methods included from TableMethods

#==, #_get_sort_index, #apply, #clone, #each_row, #group_by, #method_missing, #ncols, #nrows, #respond_to?, #set_column, #sort_by, #where

Methods included from Stacking

process_stackable_grid, #stack, stack_segments

Methods included from Joining

copy_column, #join

Methods included from Printing

calc_column_widths, format_column, format_rows, format_section, #inspect, split_column_lines

Constructor Details

#initialize(parent, indices) ⇒ StaticView

Returns a new instance of StaticView.



9
10
11
12
13
14
15
# File 'lib/object_table/static_view.rb', line 9

def initialize(parent, indices)
  super()
  @parent = parent
  @indices = indices
  @columns = ObjectTable::BasicGrid.new
  @fully_cached = false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ObjectTable::TableMethods

Instance Attribute Details

#indicesObject (readonly)

Returns the value of attribute indices.



7
8
9
# File 'lib/object_table/static_view.rb', line 7

def indices
  @indices
end

Instance Method Details

#add_column(name, *args) ⇒ Object



29
30
31
# File 'lib/object_table/static_view.rb', line 29

def add_column(name, *args)
  @columns[name] = super
end

#columnsObject



17
18
19
20
21
22
23
# File 'lib/object_table/static_view.rb', line 17

def columns
  unless @fully_cached
    @parent.columns.each_key{|k| get_column(k)}
    @fully_cached = true
  end
  @columns
end

#get_column(name) ⇒ Object



25
26
27
# File 'lib/object_table/static_view.rb', line 25

def get_column(name)
  @columns[name] ||= super
end