Sha256: 4a3f889b688aa45bf0f9564b58ecfeb21fc02c29e88c31c4b9370aa7e875afc6
Contents?: true
Size: 709 Bytes
Versions: 2
Compression:
Stored size: 709 Bytes
Contents
require 'active_support/proxy_object' class CaptainConfig::Service::DSL < ActiveSupport::ProxyObject attr_reader :service def initialize(service) @service = service end def method_missing(key, *args) type, opts, *_rest = args model = case type when :boolean ::CaptainConfig::BooleanConfig when :integer ::CaptainConfig::IntegerConfig when :string ::CaptainConfig::StringConfig else raise ArgumentError.new("Unrecognized type: #{type.inspect}") end entry = ::CaptainConfig::ConfiguredEntry.new(key, model) if opts opts.each do |opt, value| entry.send("#{opt}=", value) end end service << entry end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
captain_config-1.1.0 | lib/captain_config/service/dsl.rb |
captain_config-1.0.0 | lib/captain_config/service/dsl.rb |