Class: JCR::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/jcr/evaluate_rules.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, jcr, type, evaluation, stack_level) ⇒ Failure

Returns a new instance of Failure.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/jcr/evaluate_rules.rb', line 84

def initialize data, jcr, type, evaluation, stack_level
  if type == "member"
    @json = "\"#{data[0]}\" : #{data[1].to_json} "
  else
    @json = data.to_json
  end
  @json_elided = JCR::elide(@json)
  @data = JCR::rule_data( data )
  @rule = JCR::find_first_slice( jcr )
  @pos = @rule.line_and_column
  @offset = @rule.offset
  @type = type
  @evaluation = evaluation
  @reason_elided = "unknown reason"
  @reason_elided = JCR::elide( @evaluation.reason ) if @evaluation.reason
  @definition = JCR::rule_def( type, jcr )
  @stack_level = stack_level
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def data
  @data
end

#definitionObject

Returns the value of attribute definition.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def definition
  @definition
end

#evaluationObject

Returns the value of attribute evaluation.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def evaluation
  @evaluation
end

#jsonObject

Returns the value of attribute json.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def json
  @json
end

#json_elidedObject

Returns the value of attribute json_elided.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def json_elided
  @json_elided
end

#offsetObject

Returns the value of attribute offset.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def offset
  @offset
end

#posObject

Returns the value of attribute pos.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def pos
  @pos
end

#reason_elidedObject

Returns the value of attribute reason_elided.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def reason_elided
  @reason_elided
end

#ruleObject

Returns the value of attribute rule.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def rule
  @rule
end

#stack_levelObject

Returns the value of attribute stack_level.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def stack_level
  @stack_level
end

#typeObject

Returns the value of attribute type.



83
84
85
# File 'lib/jcr/evaluate_rules.rb', line 83

def type
  @type
end