Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Last active August 29, 2015 14:24
Show Gist options
  • Save krainboltgreene/09fe0b0dd1d1704e69a7 to your computer and use it in GitHub Desktop.
Save krainboltgreene/09fe0b0dd1d1704e69a7 to your computer and use it in GitHub Desktop.
entity = Node.new(id: id)
case
when not enity.exists? then fail("Entity doesn't exist")
when not entity.file? then fail("Entity wasn't a file")
when not entity.writable? then fail("Entity wasn't writable")
else entity.write(data)
end
entity = Node.new(id: id)
if enity.exists? && entity.file? && entity.writable?
entity.write(data)
else
fail("Entity doesn't exist") unless enity.exists?
fail("Entity wasn't a file") unless entity.file?
fail("Entity wasn't writable") unless entity.writable?
end
entity = Node.new(id: id)
fail("Entity doesn't exist") unless enity.exists?
fail("Entity wasn't a file") unless entity.file?
fail("Entity wasn't writable") unless entity.writable?
entity.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment