Class: Shoes

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#elementsObject

Returns the value of attribute elements.



10
11
12
# File 'lib/shoes/mocks/shoes.rb', line 10

def elements
  @elements
end

#eventsObject

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

.applicationObject

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 button(name, &blk)
  self.elements << Button.new(self, name, &blk)
end


44
45
46
# File 'lib/shoes/mocks/shoes.rb', line 44

def link(text, &blk)
  self.elements << Link.new(self, text, &blk)
end

#para(text) ⇒ Object



40
41
42
# File 'lib/shoes/mocks/shoes.rb', line 40

def para(text)
  self.elements << Paragraph.new(text)
end