class Packerman::Dsl
Public Class Methods
register(type: "", &block)
click to toggle source
# File lib/packerman/dsl.rb, line 3 def register(type: "", &block) product = to_subclass(type).new product.instance_eval(&block) register_to_repo(product.to_hash) end
register_to_repo(product)
click to toggle source
# File lib/packerman/dsl.rb, line 9 def register_to_repo(product) Packerman::Repository.instance.send("add_#{name.demodulize.underscore}", product) end
to_subclass(type)
click to toggle source
# File lib/packerman/dsl.rb, line 13 def to_subclass(type) "#{name}/#{type}".underscore.camelize.constantize end