Sha256: dae56e5cd0f40bad9fb4a72ed3fc974ce01c76e494992fb91aef717c10f1b623

Contents?: true

Size: 345 Bytes

Versions: 16

Compression:

Stored size: 345 Bytes

Contents

module Maestrano
  # Extend OpenStruct to include a 'attributes' method
  class OpenStruct < ::OpenStruct
    # Return all object defined attributes
    def attributes
      if self.respond_to?(:to_h)
        self.to_h.keys
      else
        (self.methods - self.class.new.methods).reject {|method| method =~ /=$/ }
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
maestrano-1.0.6 lib/maestrano/open_struct.rb
maestrano-1.0.5 lib/maestrano/open_struct.rb
maestrano-1.0.4 lib/maestrano/open_struct.rb
maestrano-1.0.3 lib/maestrano/open_struct.rb
maestrano-1.0.2 lib/maestrano/open_struct.rb
maestrano-1.0.1 lib/maestrano/open_struct.rb
maestrano-1.0.0 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC9 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC8 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC7 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC6 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC5 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC4 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC3 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC2 lib/maestrano/open_struct.rb
maestrano-1.0.0.pre.RC1 lib/maestrano/open_struct.rb