Class: Wordpress::Array

Inherits:
Object show all
Defined in:
lib/wordpress/array.rb

Direct Known Subclasses

CommentArray, LikeArray, PostArray

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

attr_parameter, #initialize

Methods inherited from OpenStruct

#[], #[]=, #initialize, #to_s

Methods inherited from Base

attr_accessor, #metaclass

Constructor Details

This class inherits a constructor from Wordpress::Object

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/wordpress/array.rb', line 22

def method_missing(method_name, *arguments, &block)
  if array_delegator.respond_to?(method_name)
    array_delegator.send(method_name, *arguments, &block)
  else
    super
  end
end

Class Method Details

.array_delegator(name) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/wordpress/array.rb', line 7

def array_delegator(name)
  class_eval "    private\n\n    def array_delegator\n      \#{name}\n    end\n  EOS\nend\n"

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/wordpress/array.rb', line 18

def respond_to_missing?(method_name, include_private = false)
  array_delegator.respod_to?(method_name, include_private)
end