Class: RBS::Annotate::Annotations::Source

Inherits:
Object
  • Object
show all
Defined in:
sig/annotate/annotations.rbs,
lib/rbs/annotate/annotations.rb

Overview

Source annotation allows where the documents are copied from.

It allows specifying two directions: the source to read from, and the source to skip.

%a{annotate:rdoc:source:from=ext/pathname}
%a{annotate:rdoc:source:skip=ext/pathname/doc}

When you want to specify several paths, repeat writing the Source annotation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(annotation:, include:) ⇒ void #initialize(annotation:, skip:) ⇒ void

Returns a new instance of Source.

Overloads:

  • #initialize(annotation:, include:) ⇒ void

    Parameters:

  • #initialize(annotation:, skip:) ⇒ void

    Parameters:



31
32
33
34
35
# File 'lib/rbs/annotate/annotations.rb', line 31

def initialize(annotation:, include: nil, skip: nil)
  @annotation = annotation
  @include_source = include
  @skip_source = skip
end

Instance Attribute Details

#annotationAST::Annotation (readonly)

Returns the value of attribute annotation.

Returns:



28
29
30
# File 'lib/rbs/annotate/annotations.rb', line 28

def annotation
  @annotation
end

#include_sourceString? (readonly)

Returns the value of attribute include_source.

Returns:

  • (String, nil)


29
30
31
# File 'lib/rbs/annotate/annotations.rb', line 29

def include_source
  @include_source
end

#skip_sourceString? (readonly)

Returns the value of attribute skip_source.

Returns:

  • (String, nil)


29
30
31
# File 'lib/rbs/annotate/annotations.rb', line 29

def skip_source
  @skip_source
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Parameters:

  • (Object)

Returns:

  • (Boolean)


41
42
43
44
45
46
# File 'lib/rbs/annotate/annotations.rb', line 41

def ==(other)
  other.is_a?(Source) &&
    other.annotation == annotation &&
    other.include_source == include_source &&
    other.skip_source == skip_source
end

#hashInteger

Returns:

  • (Integer)


37
38
39
# File 'lib/rbs/annotate/annotations.rb', line 37

def hash
  self.class.hash ^ annotation.hash ^ include_source.hash ^ skip_source.hash
end