Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
scrapbook / lib / scrapbook / configuration.rb
Size: Mime:
module Scrapbook
  class << self
    attr_reader :config

    def configure
      @config = Configuration.new
      yield config
    end
  end

  class Configuration
    SETTINGS = [:metadata_fields, :contexts, :before_action, :paperclip_processors]

    attr_accessor(*SETTINGS)

    def initialize
      @metadata_fields = HashWithIndifferentAccess.new
      @contexts = HashWithIndifferentAccess.new
      @paperclip_processors = [:cropped_resize]
    end

    def register_field(*args)
      field = MetadataField.new(*args)
      @metadata_fields[field.name] = field
    end

    def register_context(*args)
      context = Context.new(*args)
      @contexts[context.name] = context
    end
  end
end