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.



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

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



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

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)


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

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