class Argumenta::Objects::Argument
An argument includes a title, premises, and conclusion. It has an associated object record and SHA-1 hash. The object record is similar to Git’s tree. The SHA-1 identifies the argument.
Attributes
conclusion[RW]
premises[RW]
title[RW]
Public Class Methods
new(title, premises, conclusion)
click to toggle source
Initializes a new argument.
title = "My Argument ^_^" premises = [ "The first premise!", "The second premise!" ] conclusion = "The conclusion." argument = Argument.new title, premises, conclusion
# File lib/argumenta/objects/argument.rb, line 21 def initialize(title, premises, conclusion) @title = title @premises = premises.map { |p| Proposition.new p } @conclusion = Proposition.new conclusion end
Public Instance Methods
record()
click to toggle source
Gets the argument’s object record.
record = argument.record
# File lib/argumenta/objects/argument.rb, line 31 def record head = "argument\n\n" body = "title #{@title}\n" @premises.each do |p| body += "premise #{p.sha1}\n" end body += "conclusion #{@conclusion.sha1}\n" record = head + body end
sha1()
click to toggle source
Gets the argument’s SHA-1.
sha1 = argument.sha1
# File lib/argumenta/objects/argument.rb, line 45 def sha1 Digest::SHA1.hexdigest self.record end