Sha256: c420f97720867e78ecbdbd5800f9255643d52f04aad5319c2c748067612e4901
Contents?: true
Size: 784 Bytes
Versions: 4
Compression:
Stored size: 784 Bytes
Contents
module Assert; end class Assert::Context module SubjectDSL # Add a piece of description text or return the full description for the context def description(text = nil) if text self.descriptions << text.to_s else parent = self.superclass.desc if self.superclass.respond_to?(:desc) own = self.descriptions [parent, *own].compact.reject(&:empty?).join(" ") end end alias_method :desc, :description alias_method :describe, :description def subject(&block) if block_given? @subject = block else @subject || if superclass.respond_to?(:subject) superclass.subject end end end protected def descriptions @descriptions ||= [] end end end
Version data entries
4 entries across 4 versions & 1 rubygems