Class: Irwi::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



45
46
47
48
49
50
51
52
# File 'lib/irwi/config.rb', line 45

def initialize
  @controller_name = 'wiki_pages'
  @user_class_name = 'User'
  @page_class_name = 'WikiPage'
  @page_version_class_name = 'WikiPageVersion'
  @page_attachment_class_name = nil
  @page_version_foreign_key = 'page_id'
end

Instance Attribute Details

#comparatorObject



26
27
28
29
30
31
32
# File 'lib/irwi/config.rb', line 26

def comparator
  @comparator ||= begin
                    require 'irwi/comparators/diff_lcs'
                    
                    self.comparator = Irwi::Comparators::DiffLcs.new
                  end	
end

#controller_nameObject

Returns the value of attribute controller_name.



5
6
7
# File 'lib/irwi/config.rb', line 5

def controller_name
  @controller_name
end

#formatterObject



15
16
17
18
19
20
21
# File 'lib/irwi/config.rb', line 15

def formatter
  @formatter ||= begin
                   require 'irwi/formatters/red_cloth'
                   
                   self.formatter = Irwi::Formatters::RedCloth.new
                 end	
end

#page_attachment_class_nameObject

Returns the value of attribute page_attachment_class_name.



9
10
11
# File 'lib/irwi/config.rb', line 9

def page_attachment_class_name
  @page_attachment_class_name
end

#page_class_nameObject

Returns the value of attribute page_class_name.



7
8
9
# File 'lib/irwi/config.rb', line 7

def page_class_name
  @page_class_name
end

#page_version_class_nameObject

Returns the value of attribute page_version_class_name.



8
9
10
# File 'lib/irwi/config.rb', line 8

def page_version_class_name
  @page_version_class_name
end

#page_version_foreign_keyObject

Returns the value of attribute page_version_foreign_key.



10
11
12
# File 'lib/irwi/config.rb', line 10

def page_version_foreign_key
  @page_version_foreign_key
end

#paginatorObject



37
38
39
40
41
42
43
# File 'lib/irwi/config.rb', line 37

def paginator
  @paginator ||= begin
                   require 'irwi/paginators/none'
                   
                   self.paginator = Irwi::Paginators::None.new
                 end	
end

#user_class_nameObject

Returns the value of attribute user_class_name.



6
7
8
# File 'lib/irwi/config.rb', line 6

def user_class_name
  @user_class_name
end

Instance Method Details

#add_system_page(action, path) ⇒ Object

Add system page

Parameters:

  • action (String, Symbol)

    controller action

  • path (String)

    path in routes



79
80
81
# File 'lib/irwi/config.rb', line 79

def add_system_page( action, path )
  system_pages[ action.to_s ] = path.to_s
end

#page_attachment_classObject



62
63
64
# File 'lib/irwi/config.rb', line 62

def page_attachment_class
  page_attachment_class_name.constantize
end

#page_classObject



54
55
56
# File 'lib/irwi/config.rb', line 54

def page_class
  page_class_name.constantize
end

#page_version_classObject



58
59
60
# File 'lib/irwi/config.rb', line 58

def page_version_class
  page_version_class_name.constantize
end

#system_pagesObject



70
71
72
73
74
# File 'lib/irwi/config.rb', line 70

def system_pages
  @system_pages ||= {
    'all' => 'all'
  }
end

#user_classObject



66
67
68
# File 'lib/irwi/config.rb', line 66

def user_class
  user_class_name.constantize
end