Class: Qualys::Type::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/qualys_api/base.rb

Direct Known Subclasses

Host, Issue, Knowledge, Scan

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Base

Returns a new instance of Base.



73
74
75
# File 'lib/qualys_api/base.rb', line 73

def initialize(hash)
  @raw_hash = downcase_hash(hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



77
78
79
80
81
# File 'lib/qualys_api/base.rb', line 77

def method_missing(name, *args, &block)
  @raw_hash[name] if @raw_hash.key? name
  @raw_hash.each { |k, v| return v if k.to_s.to_sym == name }
  super.method_missing name
end

Instance Method Details

#respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


83
84
85
86
87
# File 'lib/qualys_api/base.rb', line 83

def respond_to?(name, include_private = false)
  return true if @raw_hash.key? name
  @raw_hash.each { |k, _v| return true if k.to_s.to_sym == name }
  super
end