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.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/acts-as-taggable-on.rb', line 49

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
  @base_class = '::ActiveRecord::Base'
end

Instance Attribute Details

#base_classObject

Returns the value of attribute base_class.



47
48
49
# File 'lib/acts-as-taggable-on.rb', line 47

def base_class
  @base_class
end

#default_parserObject

Returns the value of attribute default_parser.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def default_parser
  @default_parser
end

#delimiterObject

Returns the value of attribute delimiter.



47
48
49
# File 'lib/acts-as-taggable-on.rb', line 47

def delimiter
  @delimiter
end

#force_lowercaseObject

Returns the value of attribute force_lowercase.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def force_lowercase
  @force_lowercase
end

#force_parameterizeObject

Returns the value of attribute force_parameterize.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def force_parameterize
  @force_parameterize
end

#remove_unused_tagsObject

Returns the value of attribute remove_unused_tags.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def remove_unused_tags
  @remove_unused_tags
end

#strict_case_matchObject

Returns the value of attribute strict_case_match.



47
48
49
# File 'lib/acts-as-taggable-on.rb', line 47

def strict_case_match
  @strict_case_match
end

#taggings_tableObject

Returns the value of attribute taggings_table.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def taggings_table
  @taggings_table
end

#tags_counterObject

Returns the value of attribute tags_counter.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def tags_counter
  @tags_counter
end

#tags_tableObject

Returns the value of attribute tags_table.



43
44
45
# File 'lib/acts-as-taggable-on.rb', line 43

def tags_table
  @tags_table
end

Class Method Details

.apply_binary_collation(bincoll) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/acts-as-taggable-on.rb', line 89

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



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/acts-as-taggable-on.rb', line 76

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