Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

1.9 compat: use respond_to? to check for methods

- the .methods array returns strings in 1.8 and symbols in 1.9
  • Loading branch information...
commit fa084901f672308a1a7e1b0ddd728f313412b515 1 parent 8d1838a
@yob yob authored pat committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/thinking_sphinx/configuration.rb
View
6 lib/thinking_sphinx/configuration.rb
@@ -225,7 +225,7 @@ def parse_config
conf = YAML::load(ERB.new(IO.read(path)).result)[environment]
conf.each do |key,value|
- self.send("#{key}=", value) if self.methods.include?("#{key}=")
+ self.send("#{key}=", value) if self.respond_to?("#{key}=")
set_sphinx_setting self.source_options, key, value, SourceOptions
set_sphinx_setting self.index_options, key, value, IndexOptions
@@ -246,8 +246,8 @@ def set_sphinx_setting(object, key, value, allowed = {})
if object.is_a?(Hash)
object[key.to_sym] = value if allowed.include?(key.to_s)
else
- object.send("#{key}=", value) if object.methods.include?("#{key}")
- send("#{key}=", value) if self.methods.include?("#{key}")
+ object.send("#{key}=", value) if object.respond_to?("#{key}")
+ send("#{key}=", value) if self.respond_to?("#{key}")
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.