Class: Releaf::Settings

Inherits:
RailsSettings::Base
  • Object
show all
Defined in:
app/models/releaf/settings.rb

Defined Under Namespace

Classes: FormBuilder, NormalizeValue, Register, TableBuilder

Constant Summary collapse

@@registry =
{}.with_indifferent_access

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register(*args) ⇒ Object


32
33
34
# File 'app/models/releaf/settings.rb', line 32

def self.register(*args)
  Releaf::Settings::Register.call(settings: args)
end

.register_scopedObject


24
25
26
# File 'app/models/releaf/settings.rb', line 24

def self.register_scoped
  where(var: registered_keys)
end

.registered_keysObject


28
29
30
# File 'app/models/releaf/settings.rb', line 28

def self.registered_keys
  @@registry.keys
end

.supported_typesObject


36
37
38
# File 'app/models/releaf/settings.rb', line 36

def self.supported_types
  [:boolean, :date, :time, :datetime, :integer, :float, :decimal, :email, :text, :textarea, :richtext]
end

Instance Method Details

#descriptionObject


16
17
18
# File 'app/models/releaf/settings.rb', line 16

def description
  [:description]
end

#input_typeObject


12
13
14
# File 'app/models/releaf/settings.rb', line 12

def input_type
  [:type] || :text
end

#metadataObject


20
21
22
# File 'app/models/releaf/settings.rb', line 20

def 
  self.class.registry.fetch(var, {})
end

#releaf_titleObject


8
9
10
# File 'app/models/releaf/settings.rb', line 8

def releaf_title
  var
end