Sha256: 563a3ff3870c3c6982b805b44beab10dc102128bacf9489c12807974c9ebbd64

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

require 'active_support/configurable'

module SimpleAceInput

  def self.setup(&block)
    yield @config ||= SimpleAceInput::Configuration.new
  end

  def self.config
    @config
  end


  class Configuration
    include ActiveSupport::Configurable
    config_accessor :mode
    config_accessor :theme
    config_accessor :height
    config_accessor :precompile

    def param_name
      config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
    end

    writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
    singleton_class.class_eval writer, __FILE__, line
    class_eval writer, __FILE__, line
  end

  setup do |config|
    config.mode   = 'html'
    config.theme  = 'carto_light'
    config.height = '600'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_ace_input-0.0.1.rc lib/simple_ace_input/config.rb