Class: I18nContextGenerator::Config::Schema::Definition
- Inherits:
-
Data
- Object
- Data
- I18nContextGenerator::Config::Schema::Definition
- Defined in:
- lib/i18n_context_generator/config/schema.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
-
#yaml_path ⇒ Object
readonly
Returns the value of attribute yaml_path.
Instance Method Summary collapse
- #cli? ⇒ Boolean
- #cli_name ⇒ Object
-
#initialize(name:, type:, default:, values:, yaml_path:, cli:) ⇒ Definition
constructor
A new instance of Definition.
- #thor_options ⇒ Object
Constructor Details
#initialize(name:, type:, default:, values:, yaml_path:, cli:) ⇒ Definition
Returns a new instance of Definition.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/i18n_context_generator/config/schema.rb', line 29 def initialize(name:, type:, default:, values:, yaml_path:, cli:) default.freeze if default.respond_to?(:freeze) super( name: name, type: type, default: default, values: values&.freeze, yaml_path: yaml_path&.freeze, cli: cli&.freeze ) end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def cli @cli end |
#default ⇒ Object (readonly)
Returns the value of attribute default
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def type @type end |
#values ⇒ Object (readonly)
Returns the value of attribute values
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def values @values end |
#yaml_path ⇒ Object (readonly)
Returns the value of attribute yaml_path
28 29 30 |
# File 'lib/i18n_context_generator/config/schema.rb', line 28 def yaml_path @yaml_path end |
Instance Method Details
#cli? ⇒ Boolean
41 42 43 |
# File 'lib/i18n_context_generator/config/schema.rb', line 41 def cli? !cli.nil? end |
#cli_name ⇒ Object
45 46 47 |
# File 'lib/i18n_context_generator/config/schema.rb', line 45 def cli_name cli.fetch(:name, name) end |
#thor_options ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/i18n_context_generator/config/schema.rb', line 49 def = { desc: help_description } [:aliases] = cli[:aliases] if cli[:aliases] [:type] = cli.fetch(:type) { Schema.thor_type(type) } [:enum] = values if values [:repeatable] = true if cli[:repeatable] end |