class Unleash::Strategy::ApplicationHostname

Constants

PARAM

Attributes

hostname[RW]

Public Class Methods

new() click to toggle source
# File lib/unleash/strategy/application_hostname.rb, line 9
def initialize
  self.hostname = Socket.gethostname || 'undefined'
end

Public Instance Methods

is_enabled?(params = {}, _context = nil) click to toggle source

need: :params

# File lib/unleash/strategy/application_hostname.rb, line 18
def is_enabled?(params = {}, _context = nil)
  return false unless params.is_a?(Hash) && params.has_key?(PARAM)

  params[PARAM].split(",").map(&:strip).map(&:downcase).include?(self.hostname)
end
name() click to toggle source
# File lib/unleash/strategy/application_hostname.rb, line 13
def name
  'applicationHostname'
end