class Parlour::RbiGenerator::Extend
Represents an extend
call.
Public Class Methods
Creates a new extend
call.
@param name [String] The name of the object to be extended.
# File lib/parlour/rbi_generator/extend.rb, line 16 def initialize(generator, name: '', &block) super(generator, name) yield_self(&block) if block end
Public Instance Methods
Returns true if this instance is equal to another extend.
@param other [Object] The other instance. If this is not a {Extend} (or a
subclass of it), this will always return false.
@return [Boolean]
# File lib/parlour/rbi_generator/extend.rb, line 27 def ==(other) Extend === other && name == other.name end
Returns a human-readable brief string description of this code.
@return [String]
# File lib/parlour/rbi_generator/extend.rb, line 82 def describe "Extend (#{name})" end
# File lib/parlour/rbi_generator/extend.rb, line 87 def generalize_from_rbi!; end
Generates the RBI lines for this extend.
@param indent_level [Integer] The indentation level to generate the lines at. @param options [Options] The formatting options to use. @return [Array<String>] The RBI lines, formatted as specified.
# File lib/parlour/rbi_generator/extend.rb, line 42 def generate_rbi(indent_level, options) [options.indented(indent_level, "extend #{name}")] end
Given an array of {Extend} instances, merges them into this one. This particular implementation will simply do nothing, as instances are only mergeable if they are indentical. You MUST ensure that {mergeable?} is true for those instances.
@param others [Array<RbiGenerator::RbiObject>] An array of other
{Extend} instances.
@return [void]
# File lib/parlour/rbi_generator/extend.rb, line 74 def merge_into_self(others) # We don't need to change anything! We only merge identical extends end
Given an array of {Extend} instances, returns true if they may be merged into this instance using {merge_into_self}. This is always false.
@param others [Array<RbiGenerator::RbiObject>] An array of other
{Extend} instances.
@return [Boolean] Whether this instance may be merged with them.
# File lib/parlour/rbi_generator/extend.rb, line 57 def mergeable?(others) others.all? { |other| self == other } end