Class: Arbetsformedlingen::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/arbetsformedlingen/models/model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Model

Returns a new instance of Model.



11
12
13
# File 'lib/arbetsformedlingen/models/model.rb', line 11

def initialize(schema)
  @schema = schema
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



9
10
11
# File 'lib/arbetsformedlingen/models/model.rb', line 9

def schema
  @schema
end

Class Method Details

.from_schema(schema) ⇒ Object



5
6
7
# File 'lib/arbetsformedlingen/models/model.rb', line 5

def self.from_schema(schema)
  new(schema)
end

Instance Method Details

#errorsObject



19
20
21
# File 'lib/arbetsformedlingen/models/model.rb', line 19

def errors
  @schema.errors
end

#to_hObject



23
24
25
# File 'lib/arbetsformedlingen/models/model.rb', line 23

def to_h
  @schema.to_h
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/arbetsformedlingen/models/model.rb', line 15

def valid?
  @schema.success?
end