Class: ActsAsPreferenced::Store::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_preferenced/store/base.rb

Overview

Base class for all stores for preferences

Direct Known Subclasses

Association, Field

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, translation_scope = nil) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
# File 'lib/acts_as_preferenced/store/base.rb', line 9

def initialize( klass, translation_scope = nil )
  @klass = klass
  @translation_scope = translation_scope
  @sections = Hash.new { |h,k| h[k] = [] }
  @all_preferences = []
end

Instance Attribute Details

#all_preferencesObject (readonly)

Returns the value of attribute all_preferences.



7
8
9
# File 'lib/acts_as_preferenced/store/base.rb', line 7

def all_preferences
  @all_preferences
end

#sectionsObject (readonly)

Returns the value of attribute sections.



7
8
9
# File 'lib/acts_as_preferenced/store/base.rb', line 7

def sections
  @sections
end

#translation_scopeObject (readonly)

Returns the value of attribute translation_scope.



7
8
9
# File 'lib/acts_as_preferenced/store/base.rb', line 7

def translation_scope
  @translation_scope
end

Instance Method Details

#section(name, options = {}) {|section| ... } ⇒ Object

Yields:



16
17
18
19
# File 'lib/acts_as_preferenced/store/base.rb', line 16

def section( name, options = {} )
  section = Section.new( self, name, options )
  yield section
end