Module: Arspy::Delegators::AssociationCollectionExtensions

Defined in:
lib/arspy/delegators/association_collection_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 4

def self.included(base)
  base.define_chained_method(:method_missing, :arspy) do |symbol, *args|
    load_target unless loaded?
    result = Arspy::Operators.interpret(@target, symbol, *args)
    result = method_missing_without_arspy(symbol, *args) unless result
    result
  end
end

Instance Method Details

#ap(opts = {}) ⇒ Object



24
25
26
27
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 24

def ap(opts={})
  load_target unless loaded?
  Arspy::Operators.awesome_print(@target, opts) unless @target.empty?
end

#la(*args) ⇒ Object



12
13
14
15
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 12

def la(*args)
  load_target unless loaded?
  Arspy::Operators.list_associations(@target.first, *args) unless @target.emtpy?
end

#lf(*args) ⇒ Object



16
17
18
19
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 16

def lf(*args)
  load_target unless loaded?
  Arspy::Operators.list_fields(@target.first, *args) unless @target.empty?
end

#pr(*args) ⇒ Object



20
21
22
23
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 20

def pr(*args)
  load_target unless loaded?
  Arspy::Operators.print_array(@target, *args)
end

#wi(*args) ⇒ Object



28
29
30
31
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 28

def wi(*args)
  load_target unless loaded?
  Arspy::Operators.with(@target, *args)
end

#wo(*args) ⇒ Object



32
33
34
35
# File 'lib/arspy/delegators/association_collection_extensions.rb', line 32

def wo(*args)
  load_target unless loaded?
  Arspy::Operators.without(@target, *args)
end