Sha256: 00fb25748d0b5ed1015a711ce20258385a09114dd7111f81dfbb98b4aaddd3b4

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

require "chirrin-chirrion/version"
require "chirrin-chirrion/database_adapters/redis_adapter"

module ChirrinChirrion
  def self.config(options)
    @database_adapter = options[:database_adapter]
  end

  def self.database_adapter
    @database_adapter
  end

  def self.add_toggle(toggle_name)
    database_adapter.add_toggle(toggle_name)
  end

  def self.remove_toggle(toggle_name)
    database_adapter.remove_toggle(toggle_name)
  end

  def self.chirrin?(toggle_name)
    database_adapter.exists?(toggle_name)
  end

  def self.chirrion?(toggle_name)
    !chirrin?(toggle_name)
  end

  def self.chirrin_chirrion(toggle_name, for_chirrin, for_chirrion)
    if chirrin?(toggle_name)
      for_chirrin.respond_to?(:call) ? for_chirrin.call : for_chirrin
    else
      for_chirrion.respond_to?(:call) ? for_chirrion.call : for_chirrion
    end
  end

  private_class_method :database_adapter
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chirrin-chirrion-0.1.0 lib/chirrin-chirrion.rb