Class: Tabry::Models::Arg

Inherits:
ArgBase show all
Defined in:
lib/tabry/models/arg.rb

Constant Summary collapse

FIELDS =
{
  name: :string,
  options: [:list_object, :OptionsList],
  optional: :boolean,
  description: :string,
  varargs: :boolean,
  title: :string,
}.freeze

Instance Attribute Summary

Attributes inherited from ConfigObject

#_raw, #_root

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ConfigObject

as_json, #as_json, #assert_of_class, #init_field_boolean, #init_field_list_object, #init_field_object, #init_field_string, #init_field_string_array, #initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Tabry::Models::ConfigObject

Class Method Details

.new(**args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/tabry/models/arg.rb', line 10

def self.new(**args)
  if args[:raw]["include"]
    IncludeArg.new(**args)
  else
    super(**args)
  end
end

Instance Method Details

#flattenObject



29
30
31
# File 'lib/tabry/models/arg.rb', line 29

def flatten
  self
end

#titleObject



38
39
40
# File 'lib/tabry/models/arg.rb', line 38

def title
  @title || name
end

#varargs?Boolean

Alias (more clear intention)

Returns:

  • (Boolean)


34
35
36
# File 'lib/tabry/models/arg.rb', line 34

def varargs?
  varargs
end