Module: Emendate::Examples::Taggable

Included in:
ExampleSet, RowSet
Defined in:
lib/emendate/examples/taggable.rb

Overview

Mixin module to set up instance variables for the tag types

Instance Method Summary collapse

Instance Method Details

#set_up_tags(data_sets, date_types) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/emendate/examples/taggable.rb', line 7

def set_up_tags(data_sets, date_types)
  @data_sets = data_sets.split(";")
  @date_types = date_types.split(";")
  %i[data_sets date_types].each do |tag|
    self.class.define_method(tag) do
      instance_variable_get(:"@#{tag}")
    end
  end
end

#tags_to_sObject



17
18
19
20
21
# File 'lib/emendate/examples/taggable.rb', line 17

def tags_to_s
  # rubocop:todo Layout/LineLength
  "(data_sets: #{data_sets.join(";")}, date_types: #{date_types.join(";")})"
  # rubocop:enable Layout/LineLength
end