Class: JsonValidation::Validators::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/json_validation/validators/validator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fragment, base_uri) ⇒ Validator

Returns a new instance of Validator.



14
15
16
17
# File 'lib/json_validation/validators/validator.rb', line 14

def initialize(fragment, base_uri)
  @fragment = fragment
  @base_uri = base_uri
end

Instance Attribute Details

#base_uriObject (readonly)

Returns the value of attribute base_uri.



12
13
14
# File 'lib/json_validation/validators/validator.rb', line 12

def base_uri
  @base_uri
end

#fragmentObject (readonly)

Returns the value of attribute fragment.



12
13
14
# File 'lib/json_validation/validators/validator.rb', line 12

def fragment
  @fragment
end

Class Method Details

.type(type = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/json_validation/validators/validator.rb', line 4

def self.type(type=nil)
  if type.nil?
    @type
  else
    @type = type
  end
end

Instance Method Details

#build_validator(fragment) ⇒ Object



19
20
21
# File 'lib/json_validation/validators/validator.rb', line 19

def build_validator(fragment)
  JsonValidation.build_validator(fragment, base_uri)
end

#build_validator_with_new_base_uri(fragment, base_uri) ⇒ Object



23
24
25
# File 'lib/json_validation/validators/validator.rb', line 23

def build_validator_with_new_base_uri(fragment, base_uri)
  JsonValidation.build_validator(fragment, base_uri)
end