Class: ModalFields::HooksDsl

Inherits:
DslBase
  • Object
show all
Defined in:
lib/modalfields/modalfields.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object



86
87
88
# File 'lib/modalfields/modalfields.rb', line 86

def method_missing(name, *args, &blk)
  field_type name, *args, &blk
end

Instance Method Details

#all_fields(&blk) ⇒ Object

geric filter applied to all the fields (after a specific filter for the type, if there is one)



83
84
85
# File 'lib/modalfields/modalfields.rb', line 83

def all_fields(&blk)
  field_type :all_fields, &blk
end

#field_type(type, &blk) ⇒ Object



77
78
79
80
81
# File 'lib/modalfields/modalfields.rb', line 77

def field_type(type, &blk)
  ModalFields.hooks[type.to_sym] = lambda{|model, column_declaration|
    blk[model, column_declaration]
  }
end