Class: AbideDevUtils::Ppt::CodeIntrospection::Declaration

Inherits:
Object
  • Object
show all
Includes:
AbideDevUtils::Ppt::CodeGen::DataTypes
Defined in:
lib/abide_dev_utils/ppt/code_introspection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AbideDevUtils::Ppt::CodeGen::DataTypes

#display_type_expr, #display_type_expr_with_entries, #display_type_expr_with_left_expr, #display_value, #infer_data_type

Constructor Details

#initialize(ast) ⇒ Declaration

Returns a new instance of Declaration.



43
44
45
# File 'lib/abide_dev_utils/ppt/code_introspection.rb', line 43

def initialize(ast)
  @ast = ast.definitions.first
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



41
42
43
# File 'lib/abide_dev_utils/ppt/code_introspection.rb', line 41

def ast
  @ast
end

Instance Method Details

#parametersObject



51
52
53
54
55
# File 'lib/abide_dev_utils/ppt/code_introspection.rb', line 51

def parameters
  return unless parameters?

  @parameters ||= ast.parameters.map { |p| Parameter.new(p) }
end

#parameters?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/abide_dev_utils/ppt/code_introspection.rb', line 47

def parameters?
  ast.respond_to? :parameters
end