Class: Wikidotrb::Module::PageRevision

Inherits:
Object
  • Object
show all
Defined in:
lib/wikidotrb/module/page_revision.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page:, id:, rev_no:, created_by:, created_at:, comment:, source: nil, html: nil) ⇒ PageRevision

Initialization method

Parameters:

  • page (Page)

    Page object

  • id (Integer)

    Revision ID

  • rev_no (Integer)

    Revision number

  • created_by (AbstractUser)

    Creator

  • created_at (DateTime)

    Creation date and time

  • comment (String)

    Comment

  • source (PageSource, nil) (defaults to: nil)

    Page source

  • html (String, nil) (defaults to: nil)

    HTML source



98
99
100
101
102
103
104
105
106
107
# File 'lib/wikidotrb/module/page_revision.rb', line 98

def initialize(page:, id:, rev_no:, created_by:, created_at:, comment:, source: nil, html: nil)
  @page = page
  @id = id
  @rev_no = rev_no
  @created_by = created_by
  @created_at = created_at
  @comment = comment
  @source = source
  @html = html
end

Instance Attribute Details

#comment

Returns the value of attribute comment.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def comment
  @comment
end

#created_at

Returns the value of attribute created_at.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def created_at
  @created_at
end

#created_by

Returns the value of attribute created_by.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def created_by
  @created_by
end

#htmlString

HTML getter method Retrieve HTML if not already retrieved

Returns:

  • (String)

    HTML source



134
135
136
# File 'lib/wikidotrb/module/page_revision.rb', line 134

def html
  @html
end

#id

Returns the value of attribute id.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def id
  @id
end

#page

Returns the value of attribute page.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def page
  @page
end

#rev_no

Returns the value of attribute rev_no.



87
88
89
# File 'lib/wikidotrb/module/page_revision.rb', line 87

def rev_no
  @rev_no
end

#sourcePageSource

Source getter method Retrieve source if not already retrieved

Returns:



124
125
126
# File 'lib/wikidotrb/module/page_revision.rb', line 124

def source
  @source
end

Instance Method Details

#html_acquired?Boolean

Check if HTML has been retrieved

Returns:

  • (Boolean)

    Whether the HTML has been retrieved



117
118
119
# File 'lib/wikidotrb/module/page_revision.rb', line 117

def html_acquired?
  !@html.nil?
end

#source_acquired?Boolean

Check if source has been retrieved

Returns:

  • (Boolean)

    Whether the source has been retrieved



111
112
113
# File 'lib/wikidotrb/module/page_revision.rb', line 111

def source_acquired?
  !@source.nil?
end