Class: Fusuma::Config::Index::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/config/index.rb

Overview

Keys in Index

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol_word, skippable: false, fallback: nil) ⇒ Key

Returns a new instance of Key.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fusuma/config/index.rb', line 56

def initialize(symbol_word, skippable: false, fallback: nil)
  @symbol = begin
    symbol_word.to_sym
  rescue StandardError
    symbol_word
  end

  @skippable = skippable

  @fallback = begin
    fallback.to_sym
  rescue StandardError
    fallback
  end
end

Instance Attribute Details

#fallbackObject (readonly)

Returns the value of attribute fallback.



78
79
80
# File 'lib/fusuma/config/index.rb', line 78

def fallback
  @fallback
end

#skippableObject (readonly)

Returns the value of attribute skippable.



78
79
80
# File 'lib/fusuma/config/index.rb', line 78

def skippable
  @skippable
end

#symbolObject (readonly)

Returns the value of attribute symbol.



78
79
80
# File 'lib/fusuma/config/index.rb', line 78

def symbol
  @symbol
end

Instance Method Details

#inspectObject



72
73
74
75
76
# File 'lib/fusuma/config/index.rb', line 72

def inspect
  skip_marker = @skippable && Searcher.skip? ? '(skip)' : ''
  fallback_marker = @fallback && Searcher.fallback? ? '(fallback)' : ''
  "#{@symbol}#{skip_marker}#{fallback_marker}"
end