Class: Tabry::ConfigBuilder::ArgOrFlagBuilder

Inherits:
GenericBuilder show all
Defined in:
lib/tabry/config_builder/arg_or_flag_builder.rb

Direct Known Subclasses

FlagargBuilder

Instance Attribute Summary

Attributes inherited from GenericBuilder

#_opts

Instance Method Summary collapse

Methods inherited from GenericBuilder

#_append, #_augment_list_item, #_build, #_obj, #_set, #_set_hash, #_split_name_to_aliases, build, builder_appender, #include, init_setters, #initialize, simple_setter

Constructor Details

This class inherits a constructor from GenericBuilder

Instance Method Details

#_include(inc) ⇒ Object



12
13
14
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 12

def _include(inc)
  _append :options, { "type" => "include", "value" => inc }
end

#const(opts) ⇒ Object



37
38
39
40
41
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 37

def const(opts)
  [opts].flatten.map do |opt|
    [{ "type" => "const", "value" => opt.to_s }]
  end
end

#dirObject



33
34
35
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 33

def dir
  [{ "type" => "dir" }]
end

#fileObject



29
30
31
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 29

def file
  [{ "type" => "file" }]
end

#method(met_name) ⇒ Object

maybe I should rename this … and include… ?



25
26
27
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 25

def method(met_name)
  [{ "type" => "method", "value" => met_name.to_s }]
end

#opts(opt_hashes) ⇒ Object



16
17
18
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 16

def opts(opt_hashes)
  _append :options, *opt_hashes
end

#shell(cmd) ⇒ Object



20
21
22
# File 'lib/tabry/config_builder/arg_or_flag_builder.rb', line 20

def shell(cmd)
  [{ "type" => "shell", "value" => cmd.to_s }]
end