Class: Wee::Brush

Inherits:
Object show all
Defined in:
lib/wee/renderer/html/brushes.rb

Defined Under Namespace

Classes: AnchorTag, CheckboxTag, FileUploadTag, FormTag, GenericEncodedTextBrush, GenericSingleTagBrush, GenericTagBrush, GenericTextBrush, HiddenInputTag, ImageButtonTag, ImageTag, InputTag, JavascriptTag, Page, RadioButtonTag, SelectListTag, SelectOptionTag, SubmitButtonTag, TableDataTag, TableHeaderTag, TableRowTag, TableTag, TextAreaTag, TextInputTag

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBrush

Returns a new instance of Brush.



6
7
8
# File 'lib/wee/renderer/html/brushes.rb', line 6

def initialize
  @parent = @canvas = @closed = nil
end

Instance Attribute Details

#canvasObject

Returns the value of attribute canvas.



4
5
6
# File 'lib/wee/renderer/html/brushes.rb', line 4

def canvas
  @canvas
end

#parentObject

Returns the value of attribute parent.



4
5
6
# File 'lib/wee/renderer/html/brushes.rb', line 4

def parent
  @parent
end

Instance Method Details

#closeObject



17
18
19
# File 'lib/wee/renderer/html/brushes.rb', line 17

def close
  with unless @closed
end

#with(*args, &block) ⇒ Object



10
11
12
13
14
15
# File 'lib/wee/renderer/html/brushes.rb', line 10

def with(*args, &block)
  raise "either args or block, but not both" if block and not args.empty?

  @canvas.nest(&block) if block
  @closed = true
end