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


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

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.


14
15
16
# File 'lib/memory_io/types/record.rb', line 14

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.


10
11
12
# File 'lib/memory_io/types/record.rb', line 10

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.


39
40
41
42
43
# File 'lib/memory_io/types/record.rb', line 39

def doc
  return @force_doc if @force_doc
  return '' unless @caller
  parse_file_doc(@caller.absolute_path, @caller.lineno)
end