Peach :: Generators :: block :: BlockSize :: Class BlockSize
[hide private]

Class BlockSize

source code


Will generate size of Block or another Generator. BlockSize can can detect recursive calls and provides an optional defaultSize that can be set for such cases.

Example:

>>> block = Block([ Static('12345') ])
>>> blockSize = BlockSize( block )
>>> print blockSize.getValue()
5
Instance Methods [hide private]
 
__init__(self, block, defaultSize=1)
Base constructor, please call me!
source code
string
getValue(self)
Return data, passed through a transformer if set.
source code
string
getRawValue(self)
Returns size of block as string.
source code
Block
getBlock(self)
Get block object we act on.
source code
 
setBlock(self, block)
Set block we act on.
source code

Inherited from generator.Generator: __iter__, getGroup, getName, getTransformer, identity, next, reset, setGroup, setName, setTransformer

Class Variables [hide private]
  _inGetRawValue = 0
Method Details [hide private]

__init__(self, block, defaultSize=1)
(Constructor)

source code 

Base constructor, please call me!

Parameters:
  • block (Block) - Block to get size of
  • defaultSize (number) - To avoid recursion this is how big we are (optional)
Overrides: generator.Generator.__init__

getValue(self)

source code 

Return data, passed through a transformer if set.

Returns: string
Returns generated data
Overrides: generator.Generator.getValue

getRawValue(self)

source code 

Returns size of block as string.

Returns: string
size of specified Block
Overrides: generator.Generator.getRawValue

getBlock(self)

source code 

Get block object we act on.

Returns: Block
current Block

setBlock(self, block)

source code 

Set block we act on.

Parameters:
  • block (Block) - Block to set.