Class: Codinginfo::Variant
Instance Method Summary collapse
- #cvars ⇒ Object
- #description ⇒ Object
- #has_matching_cvar?(label) ⇒ Boolean
-
#initialize(headers, row) ⇒ Variant
constructor
A new instance of Variant.
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
#cvars ⇒ Object
56 57 58 59 60 61 |
# File 'lib/codinginfo.rb', line 56 def cvars @properties .dup .select { |key, _| key.match?(/^CVAR_/) } .map { Cvar.new(name: _1, value: _2.to_i) } end |
#description ⇒ Object
67 |
# File 'lib/codinginfo.rb', line 67 def description = @properties[:swfk_id] |
#has_matching_cvar?(label) ⇒ Boolean
63 64 65 |
# File 'lib/codinginfo.rb', line 63 def has_matching_cvar?(label) cvars.any? { _1.match?(label) } end |