Class: Trebuchet::Strategy::Base
- Inherits:
-
Object
- Object
- Trebuchet::Strategy::Base
show all
- Defined in:
- lib/trebuchet/strategy/base.rb
Direct Known Subclasses
Custom, Default, Everyone, Experiment, Hostname, Invalid, LogicBase, Multiple, Nobody, PerDenomination, Percent, PercentDeprecated, Stub, UserId, VisitorExperiment, VisitorPercent, VisitorPercentDeprecated
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#feature ⇒ Object
Returns the value of attribute feature.
5
6
7
|
# File 'lib/trebuchet/strategy/base.rb', line 5
def feature
@feature
end
|
Instance Method Details
#as_json(options = {}) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/trebuchet/strategy/base.rb', line 23
def as_json(options = {})
excluded = [:feature, :block]
{:name => name}.tap do |h|
instance_variables.map do |v|
key = v.to_s.gsub('@','').to_sym
h[key] = instance_variable_get(v) unless excluded.include?(key)
end
end
end
|
#export(options = nil) ⇒ Object
37
38
39
|
# File 'lib/trebuchet/strategy/base.rb', line 37
def export(options = nil)
{:name => self.name, :options => options}
end
|
#feature_id ⇒ Object
11
12
13
|
# File 'lib/trebuchet/strategy/base.rb', line 11
def feature_id
feature.feature_id
end
|
#inspect ⇒ Object
33
34
35
|
# File 'lib/trebuchet/strategy/base.rb', line 33
def inspect
self.to_s
end
|
#name ⇒ Object
7
8
9
|
# File 'lib/trebuchet/strategy/base.rb', line 7
def name
self.class.strategy_name
end
|
#needs_user? ⇒ Boolean
15
16
17
|
# File 'lib/trebuchet/strategy/base.rb', line 15
def needs_user?
true
end
|