Module: RailsDynamicAssociations::Config::Naming
- Defined in:
- lib/rails_dynamic_associations/config.rb
Instance Method Summary collapse
- #opposite(direction) ⇒ Object
- #opposite_shortcuts ⇒ Object
- #recursive ⇒ Object
- #selfed ⇒ Object
- #shortcuts ⇒ Object
Instance Method Details
#opposite(direction) ⇒ Object
20 21 22 |
# File 'lib/rails_dynamic_associations/config.rb', line 20 def opposite direction find { |d| d != direction } end |
#opposite_shortcuts ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rails_dynamic_associations/config.rb', line 24 def opposite_shortcuts shortcuts.each_with_object({}) do |(key, value), hash| hash[key] = shortcuts.values.find do |v| v != value end end end |
#recursive ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rails_dynamic_associations/config.rb', line 12 def recursive config.each_with_object({}) do |(key, value), hash| hash[ value[:selfed].to_s.pluralize.to_sym ] = value[:recursive] end end |
#selfed ⇒ Object
8 9 10 |
# File 'lib/rails_dynamic_associations/config.rb', line 8 def selfed config :selfed end |
#shortcuts ⇒ Object
4 5 6 |
# File 'lib/rails_dynamic_associations/config.rb', line 4 def shortcuts config :shortcut end |