Class: AdminIt::Defaults::Definer

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_it/shared.rb

Instance Method Summary collapse

Constructor Details

#initialize(caller_class) ⇒ Definer

Returns a new instance of Definer.



93
94
95
# File 'lib/admin_it/shared.rb', line 93

def initialize(caller_class)
  @caller_class = caller_class
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/admin_it/shared.rb', line 83

def method_missing(method_name, *args, &block)
  unless /\Adefault_/ =~ method_name
    method_name = "default_#{method_name}".to_sym
  end
  @caller_class.class_eval do
    define_method(method_name, &block)
    protected method_name
  end
end