Class: Parlour::RbiGenerator::RbiObject Abstract
- Inherits:
-
TypedObject
- Object
- TypedObject
- Parlour::RbiGenerator::RbiObject
- Defined in:
- lib/parlour/rbi_generator/rbi_object.rb
Overview
Instance Attribute Summary collapse
-
#generator ⇒ Generator
readonly
The generator which this object belongs to.
Attributes inherited from TypedObject
#comments, #generated_by, #name
Instance Method Summary collapse
-
#generalize_from_rbi! ⇒ void
abstract
Assuming that the types throughout this object and its children have been specified as RBI-style types, generalises them into type instances from the Types module.
-
#generate_rbi(indent_level, options) ⇒ Array<String>
abstract
Generates the RBI lines for this object.
-
#initialize(generator, name) ⇒ void
constructor
Creates a new RBI object.
-
#merge_into_self(others) ⇒ void
abstract
Given an array of other objects, merges them into this one.
-
#mergeable?(others) ⇒ Boolean
abstract
Given an array of other objects, returns true if they may be merged into this instance using #merge_into_self.
Methods inherited from TypedObject
#add_comment, #describe, #describe_tree
Constructor Details
#initialize(generator, name) ⇒ void
Don’t call this directly.
Creates a new RBI object.
19 20 21 22 23 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 19 def initialize(generator, name) super(name) @generator = generator @generated_by = RbiGenerator === generator ? generator.current_plugin : nil end |
Instance Attribute Details
#generator ⇒ Generator (readonly)
The generator which this object belongs to.
28 29 30 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 28 def generator @generator end |
Instance Method Details
#generalize_from_rbi! ⇒ void
This method returns an undefined value.
Assuming that the types throughout this object and its children have been specified as RBI-style types, generalises them into type instances from the Types module.
79 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 79 def generalize_from_rbi!; end |
#generate_rbi(indent_level, options) ⇒ Array<String>
Generates the RBI lines for this object.
42 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 42 def generate_rbi(indent_level, ); end |
#merge_into_self(others) ⇒ void
This method returns an undefined value.
Given an array of other objects, merges them into this one. Each subclass will do this differently. You MUST ensure that #mergeable? is true for those instances.
70 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 70 def merge_into_self(others); end |
#mergeable?(others) ⇒ Boolean
Given an array of other objects, returns true if they may be merged into this instance using #merge_into_self. Each subclass will have its own criteria on what allows objects to be mergeable.
56 |
# File 'lib/parlour/rbi_generator/rbi_object.rb', line 56 def mergeable?(others); end |