Class: CMS::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/cms/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route, options) ⇒ Page

Returns a new instance of Page.



4
5
6
7
8
9
10
# File 'lib/cms/page.rb', line 4

def initialize route, options
  @options = options.reverse_merge({
    editable: true
  })
  @name = route
  @route = (options[:route] || route).dup
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/cms/page.rb', line 2

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/cms/page.rb', line 2

def options
  @options
end

#routeObject (readonly)

Returns the value of attribute route.



2
3
4
# File 'lib/cms/page.rb', line 2

def route
  @route
end

Instance Method Details

#actionObject



12
13
14
# File 'lib/cms/page.rb', line 12

def action
  @action ||= (options[:action] || route).dup
end

#editable?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/cms/page.rb', line 16

def editable?
  !options[:static]
end