Sha256: 1a40ae5c132660a1f75117a204ccd731e559b5afec158812ad834f467934396e
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'singleton' module BrighterPlanet class Metadata class Cm1Authority include ::Singleton def authority?(method_id) return unless ::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 false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brighter_planet_metadata-0.0.6 | lib/brighter_planet_metadata/cm1_authority.rb |