Class: Rcurtain::Curtain
- Inherits:
-
Object
- Object
- Rcurtain::Curtain
- Defined in:
- lib/rcurtain/curtain.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(url) ⇒ Curtain
constructor
A new instance of Curtain.
- #opened?(feature, users = []) ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Curtain
Returns a new instance of Curtain.
6 7 8 |
# File 'lib/rcurtain/curtain.rb', line 6 def initialize (url) @redis = Redis.new(:url => url) end |
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
4 5 6 |
# File 'lib/rcurtain/curtain.rb', line 4 def redis @redis end |
Instance Method Details
#opened?(feature, users = []) ⇒ Boolean
10 11 12 13 14 15 16 17 18 |
# File 'lib/rcurtain/curtain.rb', line 10 def opened? (feature, users = []) feat = get_feature(feature) return (compare_percentage?(feat.percentage)) || (users.any? { |user| feat.users.include?(user)}) unless users.empty? compare_percentage?(feat.percentage) rescue Redis::CannotConnectError return false end |