Class: VivlioStarter::CLI::IndexCommands::MainReference
- Inherits:
-
Data
- Object
- Data
- VivlioStarter::CLI::IndexCommands::MainReference
- Defined in:
- lib/vivlio_starter/cli/index/main_reference.rb
Overview
main: の 1 要素
Instance Attribute Summary collapse
-
#chapter ⇒ Object
readonly
Returns the value of attribute chapter.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #section? ⇒ Boolean
-
#to_s ⇒ Object
辞書へ書き戻す形(著者が書いたとおりに保つ).
Instance Attribute Details
#chapter ⇒ Object (readonly)
Returns the value of attribute chapter
24 25 26 |
# File 'lib/vivlio_starter/cli/index/main_reference.rb', line 24 def chapter @chapter end |
#path ⇒ Object (readonly)
Returns the value of attribute path
24 25 26 |
# File 'lib/vivlio_starter/cli/index/main_reference.rb', line 24 def path @path end |
Class Method Details
.parse(value) ⇒ Object
26 27 28 29 |
# File 'lib/vivlio_starter/cli/index/main_reference.rb', line 26 def self.parse(value) chapter, *path = value.to_s.split('#') new(chapter: chapter.to_s.strip, path: path.map(&:strip).reject(&:empty?)) end |
Instance Method Details
#section? ⇒ Boolean
34 |
# File 'lib/vivlio_starter/cli/index/main_reference.rb', line 34 def section? = path.any? |
#to_s ⇒ Object
辞書へ書き戻す形(著者が書いたとおりに保つ)
32 |
# File 'lib/vivlio_starter/cli/index/main_reference.rb', line 32 def to_s = ([chapter] + path).join('#') |