Module: Fold::FoldFactory::ClassMethods
- Defined in:
- lib/fold/fold_factory.rb
Instance Method Summary collapse
- #defined_folds ⇒ Object
- #folds(id, regex = AbstractFold::Regex, clear_match = true, &block) ⇒ Object
Instance Method Details
#defined_folds ⇒ Object
65 66 67 |
# File 'lib/fold/fold_factory.rb', line 65 def defined_folds @folds||= [] end |
#folds(id, regex = AbstractFold::Regex, clear_match = true, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fold/fold_factory.rb', line 54 def folds id, regex=AbstractFold::Regex, clear_match=true, &block fold= Class.new(AbstractFold) fold.const_set :Regex, regex fold.send :define_method, :render, &block if block_given? fold.class.send :define_method, :clear_match do; clear_match end const_set id, fold defined_folds << fold end |