Class: Retab::AnyItemMatchesCondition
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::AnyItemMatchesCondition
- Defined in:
- lib/retab/workflow_tests/any_item_matches_condition.rb
Constant Summary collapse
- HASH_ATTRS =
{ kind: :kind, condition: :condition }.freeze
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#kind ⇒ Object
Returns the value of attribute kind.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ AnyItemMatchesCondition
constructor
A new instance of AnyItemMatchesCondition.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ AnyItemMatchesCondition
Returns a new instance of AnyItemMatchesCondition.
17 18 19 20 21 |
# File 'lib/retab/workflow_tests/any_item_matches_condition.rb', line 17 def initialize(json) hash = self.class.normalize(json) @kind = hash[:kind] @condition = hash[:condition] ? (case hash[:condition][:kind] when "all_items_match" then Retab::AllItemsMatchCondition.new(hash[:condition]) when "any_item_matches" then Retab::AnyItemMatchesCondition.new(hash[:condition]) when "array_contains" then Retab::ArrayContainsCondition.new(hash[:condition]) when "between" then Retab::BetweenCondition.new(hash[:condition]) when "ends_with" then Retab::EndsWithCondition.new(hash[:condition]) when "json_schema_valid" then Retab::JsonSchemaValidCondition.new(hash[:condition]) when "length_compare" then Retab::LengthCompareCondition.new(hash[:condition]) when "llm_judged_as" then Retab::LlmJudgedAsCondition.new(hash[:condition]) when "llm_not_judged_as" then Retab::LlmNotJudgedAsCondition.new(hash[:condition]) when "not_contains" then Retab::NotContainsCondition.new(hash[:condition]) when "not_equals" then Retab::NotEqualsCondition.new(hash[:condition]) when "not_exists" then Retab::NotExistsCondition.new(hash[:condition]) when "number_compare" then Retab::NumberCompareCondition.new(hash[:condition]) when "object_contains" then Retab::ObjectContainsCondition.new(hash[:condition]) when "similarity_gte" then Retab::SimilarityGteCondition.new(hash[:condition]) else hash[:condition] end) : nil end |
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
13 14 15 |
# File 'lib/retab/workflow_tests/any_item_matches_condition.rb', line 13 def condition @condition end |
#kind ⇒ Object
Returns the value of attribute kind.
13 14 15 |
# File 'lib/retab/workflow_tests/any_item_matches_condition.rb', line 13 def kind @kind end |