module NeonRAW::Objects::Thing::Editable

Methods for editing.

Public Instance Methods

delete!() click to toggle source

Deletes the thing. @!method delete!

# File lib/NeonRAW/objects/thing/editable.rb, line 38
def delete!
  params = { id: name }
  @client.request_data('/api/del', :post, params)
  refresh!
end
edit!(text) click to toggle source

Edit a thing. @!method edit!(text) @param text [String] The text to replace the current text with.

# File lib/NeonRAW/objects/thing/editable.rb, line 30
def edit!(text)
  params = { api_type: 'json', text: text, thing_id: name }
  @client.request_data('/api/editusertext', :post, params)
  refresh!
end
edited?() click to toggle source

Checks whether or not the thing was edited. @!method edited? @return [Boolean] Returns whether or not the comment was edited.

# File lib/NeonRAW/objects/thing/editable.rb, line 9
def edited?
  if @edited != false
    true
  else
    false
  end
end
last_edit() click to toggle source

Gets the timestamp of the thing's lastest edit. @!method last_edit @return [Float, nil] Returns the UNIX timestamp of the edit or nil if

the comment hasn't been edited.

@note If you crawl some old comments on /r/reddit.com this may return

true instead of the timestamp.
# File lib/NeonRAW/objects/thing/editable.rb, line 23
def last_edit
  nil || @edited if @edited != false
end