Module: Opal::Env::System

Extended by:
System
Included in:
System
Defined in:
lib/opal.rb

Instance Method Summary collapse

Instance Method Details

#array(*args) ⇒ Object

Shortcut for making arrays.



225
226
227
# File 'lib/opal.rb', line 225

def array(*args)
	return args
end

#block(code) ⇒ Object

Shortcut for making blocks.



235
236
237
238
239
# File 'lib/opal.rb', line 235

def block(code)
	return proc do
		Opal.opal_eval code
	end
end

#getObject

Shortcut for Ruby “$stdin.readline”.



220
221
222
# File 'lib/opal.rb', line 220

def get
	return $stdin.readline
end

#import(name) ⇒ Object

Shortcut for Ruby “require”.



230
231
232
# File 'lib/opal.rb', line 230

def import(name)
	require name.to_s
end

#namespace(n) ⇒ Object

Shortcut for making classes (Opal: Namespaces).



242
243
244
# File 'lib/opal.rb', line 242

def namespace(n)
	return eval("Opal::Env::#{n.to_s} = Class.new")
end

#namespace_def(ns, nm, code, *argnm) ⇒ Object

Shortcut for defining methods under classes (Opal: Namespaces).



247
248
249
# File 'lib/opal.rb', line 247

def namespace_def(ns, nm, code, *argnm)
	eval("Opal::Env::#{ns.to_s}.class_eval do\ndef #{nm.to_s}(#{argnm.join(", ")})\n#{code}\nend\nend")
end

#out(s) ⇒ Object

Shortcut for Ruby “print”.



205
206
207
# File 'lib/opal.rb', line 205

def out(s)
	print s
end

#put(s) ⇒ Object

Shortcut for Ruby “puts”.



210
211
212
# File 'lib/opal.rb', line 210

def put(s)
	puts s
end

#quitObject

Quit. (Exit)



257
258
259
# File 'lib/opal.rb', line 257

def quit
	exit
end

#run(s) ⇒ Object

Equal to “IO.popen”.



252
253
254
# File 'lib/opal.rb', line 252

def run(s)
	IO.popen(s).read
end

#tinObject

Shortcut for Ruby “$stdin.read”.



215
216
217
# File 'lib/opal.rb', line 215

def tin
	return $stdin.read
end

#versionObject

Shortcut to “version”



200
201
202
# File 'lib/opal.rb', line 200

def version
	Opal.version
end