Class: WLST::Command
- Inherits:
-
Object
show all
- Defined in:
- lib/wlst/wlst.rb
Instance Method Summary
collapse
Constructor Details
#initialize(buffer = "") ⇒ Command
Returns a new instance of Command.
145
146
147
|
# File 'lib/wlst/wlst.rb', line 145
def initialize buffer = ""
@__buffer__ = buffer
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/wlst/wlst.rb', line 149
def method_missing(symbol, *args)
args = args.to_s[1..-2]
if symbol.to_s.end_with? '='
param = symbol.to_s[0..-2]
param[0] = param[0].upcase
self << "set#{param}(#{args})"
else
self << "#{symbol}(#{args})"
end
end
|
Instance Method Details
#<<(command) ⇒ Object
160
161
162
163
164
165
|
# File 'lib/wlst/wlst.rb', line 160
def << command
append = ""
append << command << "\n"
@__buffer__ << append
append
end
|
#to_f(file) ⇒ Object
167
168
169
|
# File 'lib/wlst/wlst.rb', line 167
def to_f file
File.open(file, 'w') { |f| f.write to_s }
end
|
#to_s ⇒ Object
171
172
173
|
# File 'lib/wlst/wlst.rb', line 171
def to_s
@__buffer__.chomp
end
|