Class: Palaver::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/palaver/base.rb
Direct Known Subclasses
Calendar, Form, InfoBox, InputBox, ListWithOptions, MsgBox, PasswordBox, PathSelect, Pause, TextBox, YesNo
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/palaver/base.rb', line 6
def initialize(options)
@text = nil
@width = 0
@height = 0
options.each do |option,value|
case option
when :width then self.width(value)
when :height then self.height(value)
when :text then self.text(value)
end
end
end
|
Instance Method Details
#height(h) ⇒ Object
28
29
30
|
# File 'lib/palaver/base.rb', line 28
def height(h)
@height = h
end
|
#text(str) ⇒ Object
20
21
22
|
# File 'lib/palaver/base.rb', line 20
def text(str)
@text = str
end
|
#width(w) ⇒ Object
24
25
26
|
# File 'lib/palaver/base.rb', line 24
def width(w)
@width = w
end
|
#with_tempfile {|tfpath| ... } ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/palaver/base.rb', line 32
def with_tempfile
tf = Tempfile.new "palaver"
tfpath = tf.path
tf.close
yield tfpath
File.delete tfpath
end
|