Class: Gapic::Schema::RequestParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/gapic/schema/request_parameter.rb

Overview

Encapsulates information that is parsed from a single command line parameter from the plugin_opt command line

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_str, input_name, input_value, config_name, config_value) ⇒ RequestParameter

Returns a new instance of RequestParameter.

Parameters:

  • input_str (String)

    the input string containing parameter and value that the parameter and value were parsed from

  • input_name (String)

    the name of the parameter as found in the input can be an alias to a known config parameter name

  • input_value (String)

    the unescaped input value of the parameter as found in the input

  • config_name (String)

    the known config parameter name as matched during parsing

  • config_value (String, Array, Hash)

    the parsed and deserialized config value



35
36
37
38
39
40
41
# File 'lib/gapic/schema/request_parameter.rb', line 35

def initialize input_str, input_name, input_value, config_name, config_value
  @input_str = input_str
  @input_name = input_name
  @input_value = input_value
  @config_name = config_name
  @config_value = config_value
end

Instance Attribute Details

#config_nameObject (readonly)

Returns the value of attribute config_name.



25
26
27
# File 'lib/gapic/schema/request_parameter.rb', line 25

def config_name
  @config_name
end

#config_valueObject (readonly)

Returns the value of attribute config_value.



26
27
28
# File 'lib/gapic/schema/request_parameter.rb', line 26

def config_value
  @config_value
end

#input_nameObject (readonly)

Returns the value of attribute input_name.



23
24
25
# File 'lib/gapic/schema/request_parameter.rb', line 23

def input_name
  @input_name
end

#input_strObject (readonly)

Returns the value of attribute input_str.



22
23
24
# File 'lib/gapic/schema/request_parameter.rb', line 22

def input_str
  @input_str
end

#input_valueObject (readonly)

Returns the value of attribute input_value.



24
25
26
# File 'lib/gapic/schema/request_parameter.rb', line 24

def input_value
  @input_value
end

Instance Method Details

#to_config_hHash {String => String, Array, Hash}

The hash of config name-value

Returns:

  • (Hash {String => String, Array, Hash})


51
52
53
# File 'lib/gapic/schema/request_parameter.rb', line 51

def to_config_h
  { config_name => config_value }
end

#to_input_hHash {String => String}

The hash of input name-value

Returns:

  • (Hash {String => String})


45
46
47
# File 'lib/gapic/schema/request_parameter.rb', line 45

def to_input_h
  { input_name => input_value }
end