Class: Shoes
- Inherits:
-
Object
- Object
- Shoes
- Defined in:
- lib/shoes/mocks/shoes.rb,
lib/shoes/mocks/version.rb,
lib/shoes/mocks/bootstrap.rb,
lib/shoes/mocks/mocked_classes.rb
Overview
The classes mocked out from the C-Code
Defined Under Namespace
Modules: Mocks Classes: Alert, Background, Border, Button, Canvas, Check, EditBox, EditLine, Effect, Image, Link, ListBox, Paragraph, Progress, Radio, Shape, Text, TextBlock, TextBlockElement, TextElement, Types
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#events ⇒ Object
for alerts and other things (for now).
Class Method Summary collapse
- .app(&block) ⇒ Object
-
.application ⇒ Object
get the application that was most recently initilized with shoes unfortunately this won’t work with multiple Shoes.apps in a program, as we only get the most recent ones (see above).
Instance Method Summary collapse
- #alert(text) ⇒ Object
- #append(&blk) ⇒ Object
- #button(name, &blk) ⇒ Object
-
#initialize(&block) ⇒ Shoes
constructor
A new instance of Shoes.
- #link(text, &blk) ⇒ Object
- #para(text) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Shoes
Returns a new instance of Shoes.
15 16 17 18 19 |
# File 'lib/shoes/mocks/shoes.rb', line 15 def initialize(&block) self.elements = [] self.events = [] instance_eval(&block) if block_given? end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
10 11 12 |
# File 'lib/shoes/mocks/shoes.rb', line 10 def elements @elements end |
#events ⇒ Object
for alerts and other things (for now)
13 14 15 |
# File 'lib/shoes/mocks/shoes.rb', line 13 def events @events end |
Class Method Details
.app(&block) ⇒ Object
21 22 23 |
# File 'lib/shoes/mocks/shoes.rb', line 21 def self.app(&block) @application = new(&block) end |
.application ⇒ Object
get the application that was most recently initilized with shoes unfortunately this won’t work with multiple Shoes.apps in a program, as we only get the most recent ones (see above)
28 29 30 |
# File 'lib/shoes/mocks/shoes.rb', line 28 def self.application @application end |
Instance Method Details
#alert(text) ⇒ Object
48 49 50 |
# File 'lib/shoes/mocks/shoes.rb', line 48 def alert(text) self.events << Alert.new(text) end |
#append(&blk) ⇒ Object
32 33 34 |
# File 'lib/shoes/mocks/shoes.rb', line 32 def append(&blk) instance_eval &blk if block_given? end |
#button(name, &blk) ⇒ Object
36 37 38 |
# File 'lib/shoes/mocks/shoes.rb', line 36 def (name, &blk) self.elements << Button.new(self, name, &blk) end |