lib/brief/model.rb in brief-1.12.9 vs lib/brief/model.rb in brief-1.13.1
- old
+ new
@@ -317,16 +317,30 @@
def example_body(*args)
definition.send(:example_body, *args).to_s.strip
end
- def writing_prompt(*args)
- _prompt = definition._prompt
- return _prompt.call(*args) if _prompt && _prompt.respond_to?(:call)
- example_content
+ def new_doc_template(&block)
+ if block
+ definition.new_doc_template_block = block
+ elsif definition.new_doc_template_block
+ definition.new_doc_template_block.call
+ else
+ example_content
+ end
end
+ def new_doc_name(&block)
+ if block
+ definition.new_doc_name_block = block
+ elsif definition.new_doc_name_block
+ definition.new_doc_name_block.call
+ else
+ "#{ self.type_alias }-#{ DateTime.now.strftime("%Y-%m-%d") }.md"
+ end
+ end
+
def documentation(*args)
definition.send(:documentation, *args)
end
def defined_in(*args)
@@ -350,10 +364,10 @@
def method_missing(meth, *args, &block)
# these methods have a special effect on the behavior of the
# model definition. we need to make sure we call finalize after
# them
- if %w(meta content template example actions helpers prompt).include?(meth.to_s)
+ if %w(meta content template example actions helpers).include?(meth.to_s)
definition.send(meth, *args, &block)
finalize
elsif %w(defined_helper_methods defined_actions).include?(meth.to_s)
definition.send(meth)
elsif meth.to_s.match(/^on_(.*)_change$/)