Sha256: 1e90cd771b9fee72964738fa48629f506edfe28d99a4b55731765de54a770007
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'singleton' module BrighterPlanet class Metadata class Cm1Authority include ::Singleton def authority?(method_id) return unless defined?(::Rails) and ::Rails.env.production? and brighter_planet_server? method_id = method_id.to_s if method_id == 'certified_emitters' ::Rails.application.certified? else respond_to? method_id end end def emitters ary = [] ::ObjectSpace.each_object(::BrighterPlanet::Emitter) do |obj| ary.push obj.name.demodulize end ary end def certified_emitters emitters end def protocols emitters.map(&:constantize).map(&:protocols).flatten.uniq.inject({}) do |memo, p| memo[p] = ::File.read(::File.join(::Rails.root, 'app', 'views', 'protocols', 'names', "_#{p}.html.erb")).strip memo end end private def brighter_planet_server? require 'brighter_planet_deploy' ::BrighterPlanet.deploy.servers.me.service == 'EmissionEstimateService' rescue ::Exception false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brighter_planet_metadata-0.0.13 | lib/brighter_planet_metadata/cm1_authority.rb |