Class: MemoryIO::Types::Record Private

Inherits:
Object
  • Object
show all
Defined in:
lib/memory_io/types/record.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class that handles a registered object in Type.find. For example, this class will parse inline-docs to generate README.md.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, keys, option = {}) ⇒ Record

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instantiate a MemoryIO::Types::Record object.

Parameters:

  • object (Object)
  • keys (Array<Symbol>)
  • [Thread::Backtrace::Location] (Hash)

    a customizable set of options

  • [String] (Hash)

    a customizable set of options



28
29
30
31
32
33
# File 'lib/memory_io/types/record.rb', line 28

def initialize(object, keys, option = {})
  @obj = object
  @keys = keys
  @force_doc = option[:doc]
  @caller = option[:caller]
end

Instance Attribute Details

#keysArray<Symbol> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns All symbols that can find this record in Type.find.

Returns:

  • (Array<Symbol>)

    All symbols that can find this record in Type.find.



16
17
18
# File 'lib/memory_io/types/record.rb', line 16

def keys
  @keys
end

#objObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Whatever.

Returns:

  • (Object)

    Whatever.



12
13
14
# File 'lib/memory_io/types/record.rb', line 12

def obj
  @obj
end

Instance Method Details

#docString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the doc string.

Returns:

  • (String)

    If option doc had been passed in #initialize, this method simply returns it. Otherwise, parse the file for inline-docs. If neither doc nor caller had been passed to #initialize, an empty string is returned.



41
42
43
44
45
46
# File 'lib/memory_io/types/record.rb', line 41

def doc
  return @force_doc if @force_doc
  return '' unless @caller

  parse_file_doc(@caller.absolute_path, @caller.lineno)
end