Class: Vic::Colorscheme::Highlight::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/vic/colorscheme/highlight/argument.rb

Constant Summary collapse

VALID =
%w{term start stop cterm ctermfg ctermbg gui guifg guibg guisp font}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, val) ⇒ Argument

Returns a new instance of Argument.



7
8
9
# File 'lib/vic/colorscheme/highlight/argument.rb', line 7

def initialize(key, val)
  @key, @val = key, val
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/vic/colorscheme/highlight/argument.rb', line 5

def key
  @key
end

#valObject

Returns the value of attribute val.



5
6
7
# File 'lib/vic/colorscheme/highlight/argument.rb', line 5

def val
  @val
end

Class Method Details

.is_valid?(key) ⇒ true, false

Checks if ‘key` is valid vim key for an argument

Parameters:

  • (String, Symbol)

Returns:

  • (true, false)

    the key is valid



23
24
25
# File 'lib/vic/colorscheme/highlight/argument.rb', line 23

def self.is_valid?(key)
  VALID.include?(key.to_s)
end

Instance Method Details

#writeString?

The argument as a string

Returns:

  • (String, nil)

    the string if argument has been set



14
15
16
17
# File 'lib/vic/colorscheme/highlight/argument.rb', line 14

def write
  return unless val
  "#{key}=#{val.respond_to?(:join) ? val.join(',') : val}"
end