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 |
# File 'lib/codinginfo.rb', line 56 def cvars @properties .select { |key, _| key.match?(/^CVAR_/) } .map { Cvar.new(name: _1, value: _2.to_i) } end |
#description ⇒ Object
66 |
# File 'lib/codinginfo.rb', line 66 def description = @properties[:swfk_id] |
#has_matching_cvar?(label) ⇒ Boolean
62 63 64 |
# File 'lib/codinginfo.rb', line 62 def has_matching_cvar?(label) cvars.any? { _1.match?(label) } end |