Module: FastRuby
- Extended by:
- SingletonLogger
- Defined in:
- lib/fastruby_load_path.rb,
lib/fastruby.rb,
lib/fastruby/object.rb,
lib/fastruby/builder.rb,
lib/fastruby/logging.rb,
lib/fastruby/set_tree.rb,
lib/fastruby/getlocals.rb,
lib/fastruby/exceptions.rb,
lib/fastruby/cache/cache.rb,
lib/fastruby/fastruby_sexp.rb,
lib/fastruby/sexp_extension.rb,
lib/fastruby/method_extension.rb,
lib/fastruby/sexp_extension_edges.rb,
lib/fastruby/translator/translator.rb,
lib/fastruby/translator/modules/call.rb,
lib/fastruby/translator/modules/defn.rb,
lib/fastruby/translator/modules/flow.rb,
lib/fastruby/translator/modules/iter.rb,
lib/fastruby/translator/modules/block.rb,
lib/fastruby/translator/modules/literal.rb,
lib/fastruby/translator/modules/logical.rb,
lib/fastruby/translator/modules/nonlocal.rb,
lib/fastruby/translator/modules/variable.rb,
lib/fastruby/translator/scope_mode_helper.rb,
lib/fastruby/translator/modules/exceptions.rb,
lib/fastruby/translator/translator_modules.rb,
lib/fastruby/translator/modules/method_group.rb
Overview
This file is part of the fastruby project, github.com/tario/fastruby
Copyright © 2011 Roberto Dario Seminara <[email protected]>
fastruby is free software: you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation, either version 3 of the license, or (at your option) any later version.
fastruby is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. see the gnu general public license for more details.
you should have received a copy of the gnu general public license along with fastruby. if not, see <www.gnu.org/licenses/>.
Defined Under Namespace
Modules: BlockTranslator, BuilderModule, CallTranslator, DefnTranslator, ExceptionsTranslator, FlowControlTranslator, IterTranslator, LiteralTranslator, LogicalOperatorTranslator, MethodExtension, NonLocalTranslator, SingletonLogger, VariabeTranslator Classes: Cache, Context, FastRubySexp, GetLocalsProcessor, Graph, JumpTagException, Method, ScopeModeHelper, TranslatorModules, TypeMismatchAssignmentException
Constant Summary collapse
- VERSION =
"0.0.17"
Class Attribute Summary collapse
-
.fastruby_load_path ⇒ Object
Returns the value of attribute fastruby_load_path.
-
.fastruby_script_path ⇒ Object
Returns the value of attribute fastruby_script_path.
Class Method Summary collapse
- .cache ⇒ Object
- .encapsulate_tree(tree, method_name) ⇒ Object
- .make_str_signature(method_name, signature) ⇒ Object
- .set_builder_module(klass) ⇒ Object
- .set_tree(klass, method_name, tree, snippet_hash, options = {}) ⇒ Object
- .unset_tree(klass, method_name) ⇒ Object
Methods included from SingletonLogger
Class Attribute Details
.fastruby_load_path ⇒ Object
Returns the value of attribute fastruby_load_path.
24 25 26 |
# File 'lib/fastruby_load_path.rb', line 24 def fastruby_load_path @fastruby_load_path end |
.fastruby_script_path ⇒ Object
Returns the value of attribute fastruby_script_path.
23 24 25 |
# File 'lib/fastruby_load_path.rb', line 23 def fastruby_script_path @fastruby_script_path end |
Class Method Details
.cache ⇒ Object
26 27 28 29 |
# File 'lib/fastruby/cache/cache.rb', line 26 def self.cache @@cache = FastRuby::Cache.new(ENV['HOME']+"/.fastruby/") unless defined? @@cache @@cache end |
.encapsulate_tree(tree, method_name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fastruby/object.rb', line 33 def self.encapsulate_tree(tree, method_name) generated_tree = tree if generated_tree[0] == :scope generated_tree = s(:defn, method_name.to_sym, s(:args), s(:scope, s(:block, generated_tree[1]))) elsif generated_tree[0] == :block generated_tree = s(:defn, method_name.to_sym, s(:args), s(:scope, generated_tree)) else generated_tree = s(:defn, method_name.to_sym, s(:args), s(:scope, s(:block, generated_tree))) end generated_tree.to_fastruby_sexp end |
.make_str_signature(method_name, signature) ⇒ Object
27 28 29 |
# File 'lib/fastruby/set_tree.rb', line 27 def self.make_str_signature(method_name, signature) "_" + method_name.to_s + signature.map(&:__id__).map(&:to_s).join end |
.set_builder_module(klass) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fastruby/set_tree.rb', line 31 def self.set_builder_module(klass) klass.class_eval do class << self include FastRuby::BuilderModule end end end |
.set_tree(klass, method_name, tree, snippet_hash, options = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fastruby/set_tree.rb', line 45 def self.set_tree(klass, method_name, tree, snippet_hash, = {}) locals = Set.new locals << :self FastRuby::GetLocalsProcessor.get_locals(tree).each do |local| locals << local end klass.class_eval do class << self include FastRuby::BuilderModule end end fastrubym = klass.fastruby_method(method_name) fastrubym.tree = tree fastrubym.locals = locals fastrubym. = fastrubym.snippet_hash = snippet_hash nil end |
.unset_tree(klass, method_name) ⇒ Object
39 40 41 42 43 |
# File 'lib/fastruby/set_tree.rb', line 39 def self.unset_tree(klass, method_name) fastrubym = klass.fastruby_method(method_name) fastrubym.tree = nil nil end |