Module: Subledger::Domain::Roles::DescribableReportRendering

Included in:
Subledger::Domain::ReportRendering
Defined in:
lib/subledger/domain/roles/describable_report_rendering.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/subledger/domain/roles/describable_report_rendering.rb', line 5

def description
  @description
end

#referenceObject

Returns the value of attribute reference.



5
6
7
# File 'lib/subledger/domain/roles/describable_report_rendering.rb', line 5

def reference
  @reference
end

Class Method Details

.raise_unless_creatable(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/subledger/domain/roles/describable_report_rendering.rb', line 7

def self.raise_unless_creatable args
  report = args[:report]

  if report.nil? or not report.kind_of? Report
    raise DescribableReportRenderingError, ':report is required and must be a Report'
  end

  description = report.description

  if description.nil? or not description.kind_of? String
    raise DescribableReportRenderingError, ':report :description is required and must be a String'
  end

  reference = report.reference

  if not reference.nil? and reference !~ URI.regexp
    raise DescribableReportRenderingError, ':report :reference must be a URL'
  end

end