Method: MotionBlender::Source#initialize
- Defined in:
- lib/motion_blender/source.rb
#initialize(attrs = {}) ⇒ Source
Returns a new instance of Source.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/motion_blender/source.rb', line 27 def initialize attrs = {} @evaluated = false ast = attrs.delete :ast if ast @code = ast.loc.expression.try(:source) @file = ast.loc.expression.try(:source_buffer).try(:name) @line = ast.loc.expression.try(:line) @type = ast.type.to_s.inquiry @method = @type.send? ? ast.children[1] : nil @ast = ast end attrs.each do |k, v| instance_variable_set "@#{k}", v end @type = @type.to_s.inquiry @method = @method.try(:to_sym) end |