Method: Nelumba::Object#init

Defined in:
lib/nelumba/object.rb

#init(options = {}, &blk) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/nelumba/object.rb', line 37

def init(options = {}, &blk)
  @author        = options[:author]
  @content       = options[:content]
  @display_name  = options[:display_name]
  @uid           = options[:uid]
  @url           = options[:url]
  @summary       = options[:summary]
  @published     = options[:published] || Time.now
  @updated       = options[:updated] || Time.now
  @title         = options[:title] || "Untitled"

  options[:published] = @published
  options[:updated]   = @updated
  options[:title]     = @title

  # Alternative representations of 'content'
  @text          = options[:text] || @content || ""
  @content       = @content || options[:text]
  options[:text] = @text

  @html          = options[:html] || to_html(&blk)
  @content       = @content || @html
  options[:html] = @html
end