maroon 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,66 +0,0 @@
1
- class MethodInfo
2
- def initialize(ast, defining_role, is_private)
3
- raise("Must be S-Expressions") unless ast.instance_of?(Sexp)
4
- @defining_role = defining_role
5
- @private = is_private
6
- @definition = ast
7
- self.freeze
8
- end
9
-
10
- def is_private()
11
- @private
12
- end
13
-
14
- def name()
15
- self_definition_name
16
- end
17
-
18
- def build_as_context_method(interpretation_context)
19
- AstRewritter.new(self_definition_body, interpretation_context).rewrite!
20
- body = Ruby2Ruby.new.process(self_definition_body)
21
- raise("Body is undefined") unless body
22
- args = self_definition_arguments
23
- if args and args.length then
24
- args = (("(" + args.join(",")) + ")")
25
- else
26
- args = ""
27
- end
28
- real_name = (
29
- if (@defining_role == nil) then
30
- name.to_s
31
- else
32
- ((("self_" + @defining_role.to_s) + "_") + name.to_s)
33
- end).to_s
34
- header = (("def " + real_name) + args)
35
- (((header + " ") + body) + " end\n")
36
- end
37
-
38
- private
39
- attr_reader :definition
40
-
41
- def self_definition_body()
42
- args = definition.detect { |d| (d[0] == :args) }
43
- index = (definition.index(args) + 1)
44
- if (definition.length > (index + 1)) then
45
- body = definition[(index..-1)]
46
- body.insert(0, :block)
47
- body
48
- else
49
- definition[index]
50
- end
51
- end
52
-
53
- def self_definition_arguments()
54
- args = definition.detect { |d| (d[0] == :args) }
55
- args and (args.length > 1) ? (args[(1..-1)]) : ([])
56
- end
57
-
58
- def self_definition_name()
59
- if definition[1].instance_of?(Symbol) then
60
- definition[1]
61
- else
62
- ((definition[1].select { |e| e.instance_of?(Symbol) }.map { |e| e.to_s }.join(".") + ".") + definition[2].to_s).to_sym
63
- end
64
- end
65
-
66
- end