Class: PrettyPrint::Group
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/prettyprint.rb |
Overview
The Group class is used for making indentation easier.
While this class does neither the breaking into newlines nor indentation, it is used in a stack (as well as a queue) within ::PrettyPrint
, to group objects.
For information on using groups, see #group
This class is intended for internal use of the ::PrettyPrint
buffers.
Class Method Summary
-
.new(depth) ⇒ Group
constructor
Create a
Group
object.
Instance Attribute Summary
-
#break
readonly
Makes a break for this
Group
, and returns true. -
#break? ⇒ Boolean
readonly
Boolean of whether this
Group
has made a break. -
#breakables
readonly
Array to hold the
Breakable
objects for thisGroup
. -
#depth
readonly
This group’s relation to previous groups.
-
#first? ⇒ Boolean
readonly
Boolean of whether this
Group
has been queried for being first.
Constructor Details
.new(depth) ⇒ Group
Instance Attribute Details
#break (readonly)
Makes a break for this Group
, and returns true
# File 'lib/prettyprint.rb', line 414
def break @break = true end
#break? ⇒ Boolean
(readonly)
Boolean of whether this Group
has made a break
# File 'lib/prettyprint.rb', line 419
def break? @break end
#breakables (readonly)
Array to hold the Breakable
objects for this Group
# File 'lib/prettyprint.rb', line 411
attr_reader :breakables
#depth (readonly)
This group’s relation to previous groups
# File 'lib/prettyprint.rb', line 408
attr_reader :depth
#first? ⇒ Boolean
(readonly)
Boolean of whether this Group
has been queried for being first
This is used as a predicate, and ought to be called first.
# File 'lib/prettyprint.rb', line 426
def first? if defined? @first false else @first = false true end end