class Settingify::Builders::Group

Public Class Methods

call(*opts, &block) click to toggle source
# File lib/settingify/builders/group.rb, line 6
def self.call(*opts, &block)
  new(*opts).call(&block)
end

Public Instance Methods

call(&block) click to toggle source
# File lib/settingify/builders/group.rb, line 10
def call(&block)
  self.prepare_settings(&block)
end
setting(name, type: String, default: '') click to toggle source
Calls superclass method
# File lib/settingify/builders/group.rb, line 14
def setting(name, type: String, default: '')
  attach_to_group(name)
  super
end

Private Instance Methods

attach_to_group(setting_key) click to toggle source
# File lib/settingify/builders/group.rb, line 21
def attach_to_group(setting_key)
  group = fetch_group
  group.add setting_key
end
define_new_group() click to toggle source
# File lib/settingify/builders/group.rb, line 30
def define_new_group
  group = Settingify::Group.new(name)
  Settingify.groups << group
  group
end
fetch_group() click to toggle source
# File lib/settingify/builders/group.rb, line 26
def fetch_group
  Settingify.groups.find { |g| g.key == self.name } || define_new_group
end