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