Class: DynamicScaffold::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_scaffold/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, controller) ⇒ Config

Returns a new instance of Config.



123
124
125
126
127
128
129
130
# File 'lib/dynamic_scaffold/config.rb', line 123

def initialize(model, controller)
  @model = model
  @controller = controller
  @form = FormBuilder.new(self)
  @list = ListBuilder.new(self)
  @title = Title.new(self)
  @vars = Vars.new(self)
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



122
123
124
# File 'lib/dynamic_scaffold/config.rb', line 122

def controller
  @controller
end

#formObject (readonly)

Returns the value of attribute form.



122
123
124
# File 'lib/dynamic_scaffold/config.rb', line 122

def form
  @form
end

#listObject (readonly)

Returns the value of attribute list.



122
123
124
# File 'lib/dynamic_scaffold/config.rb', line 122

def list
  @list
end

#modelObject (readonly)

Returns the value of attribute model.



122
123
124
# File 'lib/dynamic_scaffold/config.rb', line 122

def model
  @model
end

#titleObject (readonly)

Returns the value of attribute title.



122
123
124
# File 'lib/dynamic_scaffold/config.rb', line 122

def title
  @title
end

Instance Method Details

#scope(parameter_names = nil) ⇒ Object



141
142
143
144
# File 'lib/dynamic_scaffold/config.rb', line 141

def scope(parameter_names = nil)
  @scope = parameter_names unless parameter_names.nil?
  @scope
end

#vars(name = nil, &block) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/dynamic_scaffold/config.rb', line 132

def vars(name = nil, &block)
  if block_given?
    raise ArgumentError, 'Missing var name.' if name.nil?
    @vars._register(name, block)
  else
    @vars
  end
end