Class: Hivemind::UniversalAST::Element
- Inherits:
-
Object
- Object
- Hivemind::UniversalAST::Element
show all
- Defined in:
- lib/hivemind/universal_ast.rb
Direct Known Subclasses
Assign, Attribute, AttributeAssign, Binary, Call, ClassStatement, Dictionary, IfStatement, Image, List, MethodStatement, ModuleStatement, Pair, Value
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.fields(*labels) ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/hivemind/universal_ast.rb', line 4
def self.fields(*labels)
define_method(:initialize) do |*args|
args.zip(labels).each do |arg, label|
instance_variable_set "@#{label}", arg
end
end
attr_reader *labels
end
|
Instance Method Details
#offset(depth) ⇒ Object
13
14
15
|
# File 'lib/hivemind/universal_ast.rb', line 13
def offset(depth)
' ' * depth
end
|