Module: ActiverecordMysqlRepl::Extensions::Hash
- Defined in:
- lib/active_record_mysql_repl/extensions/hash.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/active_record_mysql_repl/extensions/hash.rb', line 6
def method_missing(name, *args)
if (keys & [name, name.to_s]).present?
self[name] || self[name.to_s]
elsif name.to_s.end_with?("=") && keys.include?(name.to_s[0..-2])
name = name[0..-2]
self[name] = args.first if key?(name)
self[name.to_sym] = args.first if key?(name.to_sym)
end
end
|
Instance Method Details
#respond_to_missing?(sym, include_private) ⇒ Boolean
16
17
18
|
# File 'lib/active_record_mysql_repl/extensions/hash.rb', line 16
def respond_to_missing?(sym, include_private)
(keys & [name, name.to_s]).present? || name.to_s.end_with?("=") && keys.include?(name.to_s[0..-2])
end
|