Class: PropertyGrid::APropertyGrid

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

Overview

Class defining the property grid A property grid consists of property groups, and groups contain properties.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAPropertyGrid

Returns a new instance of APropertyGrid.



95
96
97
# File 'lib/property_grid.rb', line 95

def initialize
  @groups = []
end

Instance Attribute Details

#groupsObject

Returns the value of attribute groups.



93
94
95
# File 'lib/property_grid.rb', line 93

def groups
  @groups
end

Instance Method Details

#add_group(name) {|group| ... } ⇒ Object

Give a group name, creates a group, yielding to a block that can be used to define properties within the group, and returning self so that additional groups can be added in a fluid code style.

Yields:



102
103
104
105
106
107
108
# File 'lib/property_grid.rb', line 102

def add_group(name)
  group = PropertyGridGroup.new
  group.name = name
  @groups << group
  yield(group)          # yields to block creating group properties
  self                  # returns the PropertyGrid instance
end