Class: Gluttonberg::PageDescription::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/gluttonberg/page_description.rb

Overview

This class is used to define the sections of content in a page description. This class should never be instantiated direction, instead sections should be declared in the description DSL.

Instance Method Summary collapse

Constructor Details

#initialize(name, pos) ⇒ Section

attr_accessor :position



251
252
253
254
# File 'lib/gluttonberg/page_description.rb', line 251

def initialize(name , pos)
  @options = {:name => name, :limit => 1 , :position => pos}
  @custom_config = {}
end

Instance Method Details

#[](opt) ⇒ Object

Returns the value for the specified option — name, description etc.



274
275
276
# File 'lib/gluttonberg/page_description.rb', line 274

def [](opt)
  @options[opt]
end

#configObject

Returns the custom configuration as a hash.



279
280
281
# File 'lib/gluttonberg/page_description.rb', line 279

def config
  @custom_config
end

#configure(opts) ⇒ Object

Stores additional configuration options, which can be used by arbitrary code. Generally however it is intended to be used to provide configuration for the particular content class associated with this section.



268
269
270
271
# File 'lib/gluttonberg/page_description.rb', line 268

def configure(opts)
  @custom_config ||= {}
  @custom_config.merge!(opts)
end