Class: Spout::Models::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/spout/models/record.rb

Overview

Base class for spout variables, forms, and domains that are read from JSON files

Direct Known Subclasses

Domain, Form, Variable

Class Method Summary collapse

Class Method Details

.find_by_id(id) ⇒ Object

Only returns records with zero json errors, nil otherwise



13
14
15
16
17
# File 'lib/spout/models/record.rb', line 13

def find_by_id(id)
  file_name = Dir.glob(expected_path(id), File::FNM_CASEFOLD).first
  variable = new(file_name, dictionary_root)
  (variable.errors.size > 0 ? nil : variable)
end