Class: Jimmy::Loaders::Ruby

Inherits:
Base
  • Object
show all
Includes:
Macros
Defined in:
lib/jimmy/loaders/ruby.rb

Overview

Loads .rb files

Constant Summary

Constants included from Declaration

Declaration::BOOLEANS, Declaration::FORMATS, Declaration::SIMPLE_TYPES

Instance Attribute Summary

Attributes inherited from Base

#source

Instance Method Summary collapse

Methods included from Macros

#nothing, #ref, #schema

Methods included from Declaration

#all_of, #any_of, #array, #boolean, #const, #date, #date_time, #default, #define, #definitions, #description, #email, #enum, #examples, #hostname, #idn_email, #idn_hostname, #if, #integer, #ipv4, #ipv6, #iri, #iri_reference, #json_pointer, #multiple_of, #not, #null, #number, #object, #one_of, #pattern, #range, #read_only, #regex, #relative_json_pointer, #string, #struct, #time, #title, #type, #uri, #uri_reference, #uri_template, #write_only

Methods inherited from Base

call, #initialize

Constructor Details

This class inherits a constructor from Jimmy::Loaders::Base

Instance Method Details

#load(file = source) ⇒ Jimmy::Schema

Parameters:

  • file (Pathname, string) (defaults to: source)

Returns:



14
15
16
17
18
# File 'lib/jimmy/loaders/ruby.rb', line 14

def load(file = source)
  file = Pathname(file)
  file = source.parent + file if file.relative?
  Jimmy::Schema(instance_eval file.read, file.to_s)
end