Method: Rollout::Feature#initialize
- Defined in:
- lib/rollout/feature.rb
#initialize(name, string = nil, opts = {}) ⇒ Feature
Returns a new instance of Feature.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rollout/feature.rb', line 8 def initialize(name, string = nil, opts = {}) @options = opts @name = name if string raw_percentage, raw_users, raw_groups, raw_data = string.split('|', 4) @percentage = raw_percentage.to_f @users = users_from_string(raw_users) @groups = groups_from_string(raw_groups) @data = raw_data.nil? || raw_data.strip.empty? ? {} : JSON.parse(raw_data) else clear end end |