class Qt::Commander::Creator::InfoObject

Public Class Methods

key(name, orig_name, opts={}) click to toggle source
# File lib/qt/commander/creator/info_object.rb, line 5
def self.key name, orig_name, opts={}
  @keys ||= []
  @keys << [ name, orig_name, opts ]
  attr_reader name
end
keys() click to toggle source
# File lib/qt/commander/creator/info_object.rb, line 11
def self.keys
  @keys ||= []
end
new(info) click to toggle source
# File lib/qt/commander/creator/info_object.rb, line 20
def initialize info
  self.class.keys.each do |name, orig_name, opts|
    orig_name = [orig_name] unless orig_name.is_a? Array
    val = info
    
    orig_name.each do |orig|
      val = val.fetch(orig) if val.key? orig or !opts[:optional]
    end
    
    instance_variable_set :"@#{name}", val unless val == info
  end
end

Public Instance Methods

[](key) click to toggle source
# File lib/qt/commander/creator/info_object.rb, line 16
def [] key
  instance_variable_get :"@#{key}"
end