Class: Docter::Resource::Base

Inherits:
Object
  • Object
show all
Includes:
HTML, Reloadable
Defined in:
lib/docter/common.rb

Direct Known Subclasses

Collection::ToCResource, Page, Template

Instance Attribute Summary

Attributes included from Reloadable

#filename

Instance Method Summary collapse

Methods included from Reloadable

#modified, #modified?, #reload, #to_s

Methods included from HTML

inner_text_from, regexp_attribute, regexp_element

Constructor Details

#initialize(*args, &block) ⇒ Base

:call-seq:

new(filename, options?)
new(format, content, options?)
new(options?) { |options| ... }

The first form loads this resource from the specified file. Decides on the format based on the filename. You can then detect modification and reload as necessary, for example:

page.reload if page.modified?

The second form creates this resource from content in the specified format. This one you cannot reload. For example:

Page.new(:plain, 'HAI')

The third form creates this resource by calling the block with the supplied options.



190
191
192
# File 'lib/docter/common.rb', line 190

def initialize(*args, &block)
  init_from *args, &block
end