Module: FunWith::Configurations::GemAPI

Defined in:
lib/fun_with/configurations/gem_api.rb

Instance Method Summary collapse

Instance Method Details

#configure(object, config = nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fun_with/configurations/gem_api.rb', line 4

def configure( object, config = nil, &block )
  if block_given?
    object.install_fwc_config( config, &block )          
  else
    case config
    when String
      case yaml_or_filepath?( config )
      when :filepath
        object.install_fwc_config_from_file( config )
      when :yaml
        object.install_fwc_config_from_yaml( config )
      end
    when Pathname, FunWith::Files::FilePath
      object.install_fwc_config_from_file( config )
    when Hash, NilClass
    end
  end
end