Class: Codinginfo::Variant

Inherits:
Object show all
Defined in:
lib/codinginfo.rb

Instance Method Summary collapse

Constructor Details

#initialize(headers, row) ⇒ Variant

Returns a new instance of Variant.



52
53
54
# File 'lib/codinginfo.rb', line 52

def initialize(headers, row)
  @properties = headers.zip(row).to_h
end

Instance Method Details

#cvarsObject



56
57
58
59
60
# File 'lib/codinginfo.rb', line 56

def cvars
  @properties
    .select { |key, _| key.match?(/^CVAR_/) }
    .map { Cvar.new(name: _1, value: _2.to_i) }
end

#descriptionObject



66
# File 'lib/codinginfo.rb', line 66

def description = @properties[:swfk_id]

#has_matching_cvar?(label) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/codinginfo.rb', line 62

def has_matching_cvar?(label)
  cvars.any? { _1.match?(label) }
end