Class: ActsAsTaggableOn::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/acts-as-taggable-on.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/acts-as-taggable-on.rb', line 71

def initialize
  @delimiter = ','
  @force_lowercase = false
  @force_parameterize = false
  @strict_case_match = false
  @remove_unused_tags = false
  @tags_counter = true
  @default_parser = DefaultParser
  @force_binary_collation = false
  @tags_table = :tags
  @taggings_table = :taggings
end

Instance Attribute Details

#default_parserObject

Returns the value of attribute default_parser.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def default_parser
  @default_parser
end

#delimiterObject

Returns the value of attribute delimiter.



69
70
71
# File 'lib/acts-as-taggable-on.rb', line 69

def delimiter
  @delimiter
end

#force_lowercaseObject

Returns the value of attribute force_lowercase.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def force_lowercase
  @force_lowercase
end

#force_parameterizeObject

Returns the value of attribute force_parameterize.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def force_parameterize
  @force_parameterize
end

#remove_unused_tagsObject

Returns the value of attribute remove_unused_tags.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def remove_unused_tags
  @remove_unused_tags
end

#strict_case_matchObject

Returns the value of attribute strict_case_match.



69
70
71
# File 'lib/acts-as-taggable-on.rb', line 69

def strict_case_match
  @strict_case_match
end

#taggings_tableObject

Returns the value of attribute taggings_table.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def taggings_table
  @taggings_table
end

#tags_counterObject

Returns the value of attribute tags_counter.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def tags_counter
  @tags_counter
end

#tags_tableObject

Returns the value of attribute tags_table.



65
66
67
# File 'lib/acts-as-taggable-on.rb', line 65

def tags_table
  @tags_table
end

Class Method Details

.apply_binary_collation(bincoll) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/acts-as-taggable-on.rb', line 110

def self.apply_binary_collation(bincoll)
  if Utils.using_mysql?
    coll = 'utf8_general_ci'
    coll = 'utf8_bin' if bincoll
    begin
      ActiveRecord::Migration.execute("ALTER TABLE #{Tag.table_name} MODIFY name varchar(255) CHARACTER SET utf8 COLLATE #{coll};")
    rescue Exception => e
      puts "Trapping #{e.class}: collation parameter ignored while migrating for the first time."
    end
  end
end

Instance Method Details

#force_binary_collation=(force_bin) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/acts-as-taggable-on.rb', line 97

def force_binary_collation=(force_bin)
  if Utils.using_mysql?
    if force_bin
      Configuration.apply_binary_collation(true)
      @force_binary_collation = true
      @strict_case_match = true
    else
      Configuration.apply_binary_collation(false)
      @force_binary_collation = false
    end
  end
end