Class: Shoes::TextBlockElement

Inherits:
TextElement show all
Defined in:
lib/shoes/mocks/mocked_classes.rb

Overview

quite an inheritance chain… someone told me inheritance is bad :< But it felt like so much duplication

Direct Known Subclasses

Button, Link

Instance Attribute Summary collapse

Attributes inherited from TextElement

#text

Instance Method Summary collapse

Constructor Details

#initialize(parent, text, &blk) ⇒ TextBlockElement

Returns a new instance of TextBlockElement.



15
16
17
18
19
# File 'lib/shoes/mocks/mocked_classes.rb', line 15

def initialize(parent, text, &blk)
  super(text)
  self.parent = parent
  self.block = blk
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



14
15
16
# File 'lib/shoes/mocks/mocked_classes.rb', line 14

def block
  @block
end

#parentObject

Returns the value of attribute parent.



14
15
16
# File 'lib/shoes/mocks/mocked_classes.rb', line 14

def parent
  @parent
end

Instance Method Details

#clickObject



21
22
23
# File 'lib/shoes/mocks/mocked_classes.rb', line 21

def click
  parent.instance_eval(&block)
end