Module: Shaf::Profiles

Defined in:
lib/shaf/profiles.rb,
lib/shaf/profiles/shaf_form.rb,
lib/shaf/profiles/shaf_basic.rb,
lib/shaf/profiles/shaf_error.rb

Defined Under Namespace

Classes: ProfileNotFoundError, ShafBasic, ShafError, ShafForm

Class Method Summary collapse

Class Method Details

.clearObject



36
37
38
# File 'lib/shaf/profiles.rb', line 36

def clear
  @profiles.clear
end

.find(name) ⇒ Object



21
22
23
24
25
26
# File 'lib/shaf/profiles.rb', line 21

def find(name)
  name = String(name)
  return if name.empty?

  profiles.find { |profile| profile.match? name }
end

.find!(name) ⇒ Object



28
29
30
# File 'lib/shaf/profiles.rb', line 28

def find!(name)
  find(name) or raise ProfileNotFoundError, name
end

.profilesObject



32
33
34
# File 'lib/shaf/profiles.rb', line 32

def profiles
  @profiles ||= []
end

.register(clazz) ⇒ Object



13
14
15
# File 'lib/shaf/profiles.rb', line 13

def register(clazz)
  profiles << clazz
end

.unregister(clazz) ⇒ Object



17
18
19
# File 'lib/shaf/profiles.rb', line 17

def unregister(clazz)
  profiles.delete(clazz)
end