Module: Librarian::Source::BasicApi

Included in:
Mock::Source::Mock, Git, Path
Defined in:
lib/librarian/source/basic_api.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/librarian/source/basic_api.rb', line 5

def self.included(base)
  base.extend ClassMethods
  class << base
    def lock_name(name)
      def_sclass_prop(:lock_name, name)
    end

    def spec_options(keys)
      def_sclass_prop(:spec_options, keys)
    end

  private

    def def_sclass_prop(name, arg)
      sclass = class << self ; self ; end
      sclass.module_exec do
        remove_method(name)
        define_method(name) { arg }
      end
    end
  end
end