Class: ActiveScaffold::Config::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveScaffold::Configurable
Includes:
ActiveScaffold::Configurable
Defined in:
lib/active_scaffold/config/base.rb

Defined Under Namespace

Classes: UserSettings

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveScaffold::Configurable

configure, method_missing

Constructor Details

#initialize(core_config) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
# File 'lib/active_scaffold/config/base.rb', line 6

def initialize(core_config)
  @core = core_config
  @action_group = self.class.action_group.clone if self.class.action_group

  # start with the ActionLink defined globally
  @link = self.class.link.clone if self.class.respond_to?(:link) && self.class.link
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable

Instance Attribute Details

#action_groupObject

action_group this action should belong to



48
49
50
# File 'lib/active_scaffold/config/base.rb', line 48

def action_group
  @action_group
end

#coreObject (readonly)

Returns the value of attribute core.



13
14
15
# File 'lib/active_scaffold/config/base.rb', line 13

def core
  @core
end

#formatsObject



76
77
78
# File 'lib/active_scaffold/config/base.rb', line 76

def formats
  @formats ||= []
end

#userObject

the user property gets set to the instantiation of the local UserSettings class during the automatic instantiation of this class.



41
42
43
# File 'lib/active_scaffold/config/base.rb', line 41

def user
  @user
end

Class Method Details

.inherited(subclass) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_scaffold/config/base.rb', line 15

def self.inherited(subclass)
  class << subclass
    # the crud type of the action. possible values are :create, :read, :update, :delete, and nil.
    # this is not a setting for the developer. it's self-description for the actions.
    attr_reader :crud_type

    protected

    def crud_type=(val)
      raise ArgumentError, "unknown CRUD type #{val}" unless [:create, :read, :update, :delete].include?(val.to_sym)
      @crud_type = val.to_sym
    end
  end
end

Instance Method Details

#crud_typeObject

delegate



31
32
33
# File 'lib/active_scaffold/config/base.rb', line 31

def crud_type
  self.class.crud_type
end

#label(model = nil) ⇒ Object



35
36
37
38
# File 'lib/active_scaffold/config/base.rb', line 35

def label(model = nil)
  model ||= @core.label(:count => 1)
  @label.nil? ? model : as_(@label, :model => model)
end