Class: Featurevisor::Modules::FeaturevisorModule

Inherits:
Object
  • Object
show all
Defined in:
lib/featurevisor/modules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FeaturevisorModule

Returns a new instance of FeaturevisorModule.



11
12
13
14
15
16
17
18
19
20
# File 'lib/featurevisor/modules.rb', line 11

def initialize(options = {})
  @id = SecureRandom.uuid
  @name = options[:name]
  @setup = options[:setup]
  @before = options[:before]
  @bucket_key = options[:bucket_key]
  @bucket_value = options[:bucket_value]
  @after = options[:after]
  @close = options[:close]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/featurevisor/modules.rb', line 9

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/featurevisor/modules.rb', line 9

def name
  @name
end

Instance Method Details

#call_after(evaluation, options) ⇒ Object



44
45
46
47
48
# File 'lib/featurevisor/modules.rb', line 44

def call_after(evaluation, options)
  return evaluation unless @after

  @after.call(evaluation, options)
end

#call_before(options) ⇒ Object



26
27
28
29
30
# File 'lib/featurevisor/modules.rb', line 26

def call_before(options)
  return options unless @before

  @before.call(options)
end

#call_bucket_key(options) ⇒ Object



32
33
34
35
36
# File 'lib/featurevisor/modules.rb', line 32

def call_bucket_key(options)
  return options[:bucket_key] unless @bucket_key

  @bucket_key.call(options)
end

#call_bucket_value(options) ⇒ Object



38
39
40
41
42
# File 'lib/featurevisor/modules.rb', line 38

def call_bucket_value(options)
  return options[:bucket_value] unless @bucket_value

  @bucket_value.call(options)
end

#call_closeObject



50
51
52
# File 'lib/featurevisor/modules.rb', line 50

def call_close
  @close.call if @close
end

#call_setup(api) ⇒ Object



22
23
24
# File 'lib/featurevisor/modules.rb', line 22

def call_setup(api)
  @setup.call(api) if @setup
end