Class: DissociatedIntrospection::RubyClass::CreateDef
- Inherits:
-
Object
- Object
- DissociatedIntrospection::RubyClass::CreateDef
- Defined in:
- lib/dissociated_introspection/ruby_class/create_def.rb
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(ast, comments) ⇒ CreateDef
constructor
A new instance of CreateDef.
Constructor Details
#initialize(ast, comments) ⇒ CreateDef
Returns a new instance of CreateDef.
6 7 8 9 |
# File 'lib/dissociated_introspection/ruby_class/create_def.rb', line 6 def initialize(ast, comments) @ast = ast @comments = comments end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
4 5 6 |
# File 'lib/dissociated_introspection/ruby_class/create_def.rb', line 4 def ast @ast end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
4 5 6 |
# File 'lib/dissociated_introspection/ruby_class/create_def.rb', line 4 def comments @comments end |
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dissociated_introspection/ruby_class/create_def.rb', line 11 def create def_comments = comments.select do |comment| comment.location.last_line + 1 == ast.location.first_line end Def.new(RubyCode.build_from_ast(ast, comments: def_comments)) end |