class DhcpsApi::DHCPS_Struct

Public Class Methods

ruby_struct_attr(func_name, *attr_names) click to toggle source
# File lib/dhcpsapi/common.rb, line 47
def self.ruby_struct_attr(func_name, *attr_names)
  attr_names.each do |attr_name|
    define_method("#{attr_name}_as_ruby_struct_attr") { send(func_name, self[attr_name])}
  end
end

Public Instance Methods

as_ruby_struct() click to toggle source
# File lib/dhcpsapi/common.rb, line 53
def as_ruby_struct
  members.inject({}) do |all, current|
    all[current] =
        if respond_to?("#{current}_as_ruby_struct_attr")
          send("#{current}_as_ruby_struct_attr")
        elsif self[current].is_a?(DHCPS_Struct)
          self[current].as_ruby_struct
        else
          self[current]
        end
    all
  end
end