Class: Dhall::Import::IntegrityCheck
- Inherits:
-
Object
- Object
- Dhall::Import::IntegrityCheck
show all
- Defined in:
- lib/dhall/ast.rb
Defined Under Namespace
Classes: FailureException
Instance Method Summary
collapse
Constructor Details
#initialize(protocol = :nocheck, data = nil) ⇒ IntegrityCheck
Returns a new instance of IntegrityCheck.
1085
1086
1087
1088
1089
1090
|
# File 'lib/dhall/ast.rb', line 1085
def initialize(protocol=:nocheck, data=nil)
super(
protocol: protocol,
data: data
)
end
|
Instance Method Details
#as_json ⇒ Object
1105
1106
1107
|
# File 'lib/dhall/ast.rb', line 1105
def as_json
@protocol == :nocheck ? nil : [@protocol, @data]
end
|
#check(expr) ⇒ Object
1096
1097
1098
1099
1100
1101
1102
1103
|
# File 'lib/dhall/ast.rb', line 1096
def check(expr)
return expr if @protocol == :nocheck
expr = expr.normalize
return expr if expr.cache_key == to_s
raise FailureException, "#{expr} does not match #{self}"
end
|
#to_s ⇒ Object
1092
1093
1094
|
# File 'lib/dhall/ast.rb', line 1092
def to_s
"#{@protocol}:#{@data}"
end
|