Class: VivlioStarter::CLI::PreProcessCommands::TalkRegistry::Registry
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::PreProcessCommands::TalkRegistry::Registry
- Defined in:
- lib/vivlio_starter/cli/pre_process/talk_registry.rb
Overview
正規化結果の集合。present はファイルの実在(.talk 使用時のエラー分岐に使う)。
Instance Attribute Summary collapse
-
#characters ⇒ Object
readonly
Returns the value of attribute characters.
-
#display ⇒ Object
readonly
Returns the value of attribute display.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(characters, display:, present:) ⇒ Registry
constructor
A new instance of Registry.
- #key?(key) ⇒ Boolean
- #present? ⇒ Boolean
-
#with_color ⇒ Object
色を明示指定した(有効な)キャラクターのみ(生成 CSS の対象)。.
Constructor Details
#initialize(characters, display:, present:) ⇒ Registry
Returns a new instance of Registry.
80 81 82 83 84 85 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 80 def initialize(characters, display:, present:) @characters = characters.freeze @by_key = characters.to_h { [it.key, it] }.freeze @display = display @present = present end |
Instance Attribute Details
#characters ⇒ Object (readonly)
Returns the value of attribute characters.
75 76 77 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 75 def characters @characters end |
#display ⇒ Object (readonly)
Returns the value of attribute display.
75 76 77 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 75 def display @display end |
Instance Method Details
#[](key) ⇒ Object
87 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 87 def [](key) = @by_key[key.to_s] |
#empty? ⇒ Boolean
90 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 90 def empty? = @characters.empty? |
#key?(key) ⇒ Boolean
88 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 88 def key?(key) = @by_key.key?(key.to_s) |
#present? ⇒ Boolean
89 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 89 def present? = @present |
#with_color ⇒ Object
色を明示指定した(有効な)キャラクターのみ(生成 CSS の対象)。
93 |
# File 'lib/vivlio_starter/cli/pre_process/talk_registry.rb', line 93 def with_color = @characters.select(&:color) |