incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Sedovic <tsedo...@redhat.com>
Subject Re: [PATCH core] Added method_missing for undefined attributes in client
Date Wed, 06 Oct 2010 12:01:46 GMT
ACK

On 10/06/2010 01:42 PM, mfojtik@redhat.com wrote:
> From: Michal Fojtik<mfojtik@redhat.com>
>
> ---
>   client/lib/deltacloud.rb |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
> index 0eeb4e4..96674ce 100644
> --- a/client/lib/deltacloud.rb
> +++ b/client/lib/deltacloud.rb
> @@ -149,6 +149,8 @@ module DeltaCloud
>           c.instance_eval do
>             attr_accessor :id
>             attr_accessor :uri
> +
> +
>           end
>           obj = xml_to_class(c, item)
>         end
> @@ -162,6 +164,10 @@ module DeltaCloud
>         obj.id = item['id']
>         api = self
>         c.instance_eval do
> +        define_method :method_missing do |method|
> +            warn "[WARNING] Method '#{method}' is not available for this resource (#{c.name})."
> +            return nil
> +        end
>           define_method :client do
>             api
>           end

Mime
View raw message