Sha256: 8cd199f6a01de7592847c073177946af70969e18a50a48dc429b4f978d6bcb99
Contents?: true
Size: 1.56 KB
Versions: 21
Compression:
Stored size: 1.56 KB
Contents
class ServiceInstanceHelper def self.new(instance) "#{instance.class.name.demodulize}Helper".constantize.new(instance) end end class UserProvidedServiceInstanceHelper def initialize(instance) @instance = instance end def service_label "user-provided" end def service_provider "n/a" end def version "n/a" end def plan_name "n/a" end def matches(opts = {}) label = opts[:service] if label return label == service_label end true end def name @instance.name end def service_bindings @instance.service_bindings end end class ManagedServiceInstanceHelper def initialize(service_instance) @instance = service_instance end def service_label @instance.service_plan.service.label end def service_provider @instance.service_plan.service.provider end def version @instance.service_plan.service.version end def plan_name @instance.service_plan.name end def service_bindings @instance.service_bindings end def name @instance.name end def matches(opts = {}) service = opts[:service] plan = opts[:plan] provider = opts[:provider] version = opts[:version] if service return false unless File.fnmatch(service, service_label) end if plan return false unless File.fnmatch(plan.upcase, plan_name.upcase) end if provider return false unless File.fnmatch(provider, service_provider) end if version return false unless File.fnmatch(version, self.version) end true end end
Version data entries
21 entries across 21 versions & 2 rubygems