Class: Librarian::Dsl::Target::SourceShortcutDefinitionReceiver
- Inherits:
-
Object
- Object
- Librarian::Dsl::Target::SourceShortcutDefinitionReceiver
- Defined in:
- lib/librarian/dsl/target.rb
Instance Method Summary collapse
-
#initialize(target) ⇒ SourceShortcutDefinitionReceiver
constructor
A new instance of SourceShortcutDefinitionReceiver.
Constructor Details
#initialize(target) ⇒ SourceShortcutDefinitionReceiver
Returns a new instance of SourceShortcutDefinitionReceiver.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/librarian/dsl/target.rb', line 8 def initialize(target) singleton_class = class << self; self end singleton_class.class_eval do define_method(:source) do || target.() end target.source_types.each do |source_type| name = source_type[0] define_method(name) do |*args| args.push({}) unless Hash === args.last target.source_from_params(name, *args) end end end end |