Class: Sourcerer::SourceSkim::Config Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sourcerer/source_skim/config.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.

Configuration profile for a single SourceSkim pass.

Controls which section shapes and element categories are emitted. Callers pass a Config instance to Skimmer#process; it is not part of the public-facing module API and should be constructed via the keyword arguments on skim_file and friends.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(forms: [:tree], categories: nil) ⇒ Config

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 a new instance of Config.



35
36
37
38
# File 'lib/sourcerer/source_skim/config.rb', line 35

def initialize forms: [:tree], categories: nil
  @forms = Array(forms).map(&:to_sym)
  @categories = categories ? Array(categories).map(&:to_sym) : DEFAULT_CATEGORIES.dup
end

Instance Attribute Details

#categoriesObject (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.



33
34
35
# File 'lib/sourcerer/source_skim/config.rb', line 33

def categories
  @categories
end

#formsObject (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.



33
34
35
# File 'lib/sourcerer/source_skim/config.rb', line 33

def forms
  @forms
end

Instance Method Details

#flat?Boolean

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:

  • (Boolean)


48
49
50
# File 'lib/sourcerer/source_skim/config.rb', line 48

def flat?
  @forms.include?(:flat)
end

#include?(category) ⇒ Boolean

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:

  • (Boolean)


40
41
42
# File 'lib/sourcerer/source_skim/config.rb', line 40

def include? category
  @categories.include?(category.to_sym)
end

#tree?Boolean

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:

  • (Boolean)


44
45
46
# File 'lib/sourcerer/source_skim/config.rb', line 44

def tree?
  @forms.include?(:tree)
end