Module: RVM
- Defined in:
- lib/rvm.rb,
lib/rvm/plugin.rb,
lib/rvm/classes.rb,
lib/rvm/library.rb,
lib/rvm/functions.rb,
lib/rvm/languages.rb,
lib/rvm/environment.rb,
lib/rvm/interpreter.rb,
lib/rvm/classes/list.rb,
lib/rvm/classes/null.rb,
lib/rvm/optimisation.rb,
lib/rvm/classes/block.rb,
lib/rvm/classes/class.rb,
lib/rvm/classes/error.rb,
lib/rvm/classes/number.rb,
lib/rvm/classes/object.rb,
lib/rvm/classes/string.rb,
lib/rvm/languages/ecma.rb,
lib/rvm/languages/math.rb,
lib/rvm/classes/boolean.rb,
lib/rvm/functions/array/at.rb,
lib/rvm/functions/io/print.rb,
lib/rvm/functions/list/map.rb,
lib/rvm/functions/logic/or.rb,
lib/rvm/functions/math/add.rb,
lib/rvm/functions/math/cos.rb,
lib/rvm/functions/math/div.rb,
lib/rvm/functions/math/mod.rb,
lib/rvm/functions/math/mul.rb,
lib/rvm/functions/math/neg.rb,
lib/rvm/functions/math/shl.rb,
lib/rvm/functions/math/shr.rb,
lib/rvm/functions/math/sin.rb,
lib/rvm/functions/math/sub.rb,
lib/rvm/functions/math/tan.rb,
lib/rvm/classes/association.rb,
lib/rvm/functions/list/join.rb,
lib/rvm/functions/logic/and.rb,
lib/rvm/functions/logic/not.rb,
lib/rvm/languages/brainfuck.rb,
lib/rvm/languages/math/tree.rb,
lib/rvm/functions/general/eq.rb,
lib/rvm/functions/general/gt.rb,
lib/rvm/functions/general/lt.rb,
lib/rvm/functions/list/align.rb,
lib/rvm/functions/list/split.rb,
lib/rvm/functions/math/power.rb,
lib/rvm/functions/string/chr.rb,
lib/rvm/functions/general/cmp.rb,
lib/rvm/functions/general/gte.rb,
lib/rvm/functions/general/lte.rb,
lib/rvm/functions/general/neq.rb,
lib/rvm/functions/rails/print.rb,
lib/rvm/functions/string/ansi.rb,
lib/rvm/functions/array/append.rb,
lib/rvm/functions/array/set_at.rb,
lib/rvm/functions/objects/send.rb,
lib/rvm/functions/string/ljust.rb,
lib/rvm/functions/string/rjust.rb,
lib/rvm/functions/string/capstr.rb,
lib/rvm/functions/string/center.rb,
lib/rvm/languages/ecma/compiler.rb,
lib/rvm/languages/math/compiler.rb,
lib/rvm/functions/collection/get.rb,
lib/rvm/functions/collection/set.rb,
lib/rvm/languages/math/tokenizer.rb,
lib/rvm/functions/collection/size.rb,
lib/rvm/functions/string/regmatch.rb,
lib/rvm/functions/bitwise/bitwise_or.rb,
lib/rvm/functions/bitwise/bitwise_and.rb,
lib/rvm/functions/bitwise/bitwise_xor.rb,
lib/rvm/functions/association/assoc_get.rb,
lib/rvm/functions/association/assoc_set.rb
Overview
The MIT License
Copyright © 2008 Heinz N. ‘Licenser’ Gies
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Ruby Mush”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Defined Under Namespace
Modules: ActsAsRVMType, Classes, Functions, Interpreter, Languages, Plugin, PluginHost Classes: Library, Safety
Constant Summary collapse
- VERSION =
"0.0.16"
- @@strict =
false
Class Method Summary collapse
-
.compile(language, code) ⇒ Object
Compils a code the given language.
-
.compiler_for(language) ⇒ Object
Creates you a compiler object for the given language.
-
.debug(text) ⇒ Object
A utility function to give debug output based on weather $DEBUG is set or not.
-
.require_plugin(path) ⇒ Object
Convenience method for plugin loading.
-
.strict ⇒ Object
This getter returns if rVM handles types strict.
-
.strict=(v) ⇒ Object
Sets if variables are strictly typed or casted for function calls.
Class Method Details
.compile(language, code) ⇒ Object
Compils a code the given language. A new compiler is created for that and discarded afterwards.
Using compiler_for
and calling compile for it yourself is more performant if you plan on doing thise more then once.
75 76 77 |
# File 'lib/rvm.rb', line 75 def compile language, code compiler_for(language).compile(code) end |
.compiler_for(language) ⇒ Object
Creates you a compiler object for the given language. If no language is given a error is raised.
81 82 83 84 85 86 87 |
# File 'lib/rvm.rb', line 81 def compiler_for language if (l = RVM::Languages[language]) l.new else raise "RVM Error: Unknown Language #{language}" end end |
.debug(text) ⇒ Object
A utility function to give debug output based on weather $DEBUG is set or not
90 91 92 |
# File 'lib/rvm.rb', line 90 def debug text puts ">>> #{text}" if $DEBUG end |
.require_plugin(path) ⇒ Object
Convenience method for plugin loading. The syntax used is:
RVM.require_plugin '<Host ID>/<Plugin ID>'
Returns the loaded plugin.
329 330 331 332 333 334 335 |
# File 'lib/rvm/plugin.rb', line 329 def self.require_plugin path host_id, plugin_id = path.split '/', 2 host = PluginHost.host_by_id(host_id) raise PluginHost::HostNotFound, "No host for #{host_id.inspect} found." unless host host.load plugin_id end |
.strict ⇒ Object
This getter returns if rVM handles types strict.
Calling a method with wrong types will raise a error if this is true. If false rVM will try to typecast accordingly.
60 61 62 |
# File 'lib/rvm.rb', line 60 def strict @@strict end |
.strict=(v) ⇒ Object
Sets if variables are strictly typed or casted for function calls. This allows to make a language either more secure or more flexible.
66 67 68 |
# File 'lib/rvm.rb', line 66 def strict= v @@strict = v end |