Sha256: 5da083aa29599fc795a5baad1405baff8a6215f3e68e023629b0109c077c9940

Contents?: true

Size: 909 Bytes

Versions: 6

Compression:

Stored size: 909 Bytes

Contents

module MonkeyWrench
  class Member
    def initialize(list_member_info)
      @list_member_info = list_member_info
    end

    def interests
      if @list_member_info['merges']['INTERESTS']
        @list_member_info['merges']['INTERESTS'].split(', ')
      end
    end
    
    def method_missing(method, *args)
      if responds_to?(method)
        key_name = method.to_s
        @list_member_info[key_name] || @list_member_info['merges'][key_name] || @list_member_info['merges'][key_name.upcase]
      else
        super
      end
    end
    
    def responds_to?(method)
      key_name = method.to_s
      @list_member_info.has_key?(key_name) || 
        @list_member_info['merges'].has_key?(key_name) ||
        @list_member_info['merges'].has_key?(key_name.upcase)
    end
    
    def ==(other_member)
      !@list_member_info.keys.detect{|key| send(key) != other_member.send(key)}
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
monkeywrench-0.1.7 lib/monkeywrench/member.rb
monkeywrench-0.1.6 lib/monkeywrench/member.rb
monkeywrench-0.1.5 lib/monkeywrench/member.rb
monkey_wrench-0.1.4 lib/monkey_wrench/member.rb
monkey_wrench-0.1.2 lib/monkey_wrench/member.rb
monkey_wrench-0.1.0 lib/monkey_wrench/member.rb