Class: TuneSpec::Instances::Tuner

Inherits:
Object
  • Object
show all
Defined in:
lib/tune_spec/instances/tuner.rb

Overview

Abstract class for Group, Step and Page

Direct Known Subclasses

Groups, Page, Steps

Class Method Summary collapse

Class Method Details

.call_object(file_name) ⇒ Object



26
27
28
29
30
# File 'lib/tune_spec/instances/tuner.rb', line 26

def call_object(file_name)
  ensure_required(file_name)
  const_name = file_name.split('_').each(&:capitalize!).join('')
  const_get(const_name)
end

.format_opts(opts, instance_klass) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/tune_spec/instances/tuner.rb', line 17

def format_opts(opts, instance_klass)
  default_opts = fetch_default_opts
  pre_format_opts(opts).tap do |hash|
    default_opts.each do |key, value|
      hash[key] = value if argument_required?(key, instance_klass)
    end
  end
end

.instance_method_name(name) ⇒ Object



8
9
10
# File 'lib/tune_spec/instances/tuner.rb', line 8

def instance_method_name(name)
  "#{name}_#{type}".downcase
end

.object_typeObject



32
33
34
# File 'lib/tune_spec/instances/tuner.rb', line 32

def object_type
  :common
end

.rules_passed?(_instance, _opts = {}) ⇒ Boolean

A hook to define rules by subclasses

Returns:

  • (Boolean)


13
14
15
# File 'lib/tune_spec/instances/tuner.rb', line 13

def rules_passed?(_instance, _opts = {})
  raise "Implement a #rules_passed? method for #{self}"
end