Class: VCAP::JsonSchema::HashSchema::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/vcap/json_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, schema, optional = false) ⇒ Field

Returns a new instance of Field.

Raises:

  • (ArgumentError)


106
107
108
109
110
111
# File 'lib/vcap/json_schema.rb', line 106

def initialize(name, schema, optional=false)
  raise ArgumentError, "Schema must be an instance of a schema, #{schema.class} given #{schema.inspect}" unless schema.kind_of?(BaseSchema)
  @name = name
  @schema = schema
  @optional = optional
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



103
104
105
# File 'lib/vcap/json_schema.rb', line 103

def name
  @name
end

#optionalObject

Returns the value of attribute optional.



104
105
106
# File 'lib/vcap/json_schema.rb', line 104

def optional
  @optional
end

#schemaObject (readonly)

Returns the value of attribute schema.



103
104
105
# File 'lib/vcap/json_schema.rb', line 103

def schema
  @schema
end