Class: MonkeyWrench::Member
- Inherits:
-
Object
- Object
- MonkeyWrench::Member
show all
- Defined in:
- lib/monkey_wrench/member.rb
Instance Method Summary
collapse
Constructor Details
#initialize(list_member_info) ⇒ Member
Returns a new instance of Member.
3
4
5
|
# File 'lib/monkey_wrench/member.rb', line 3
def initialize(list_member_info)
@list_member_info = list_member_info
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/monkey_wrench/member.rb', line 13
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
|
Instance Method Details
#==(other_member) ⇒ Object
29
30
31
|
# File 'lib/monkey_wrench/member.rb', line 29
def ==(other_member)
!@list_member_info.keys.detect{|key| send(key) != other_member.send(key)}
end
|
#interests ⇒ Object
7
8
9
10
11
|
# File 'lib/monkey_wrench/member.rb', line 7
def interests
if @list_member_info['merges']['INTERESTS']
@list_member_info['merges']['INTERESTS'].split(', ')
end
end
|
#responds_to?(method) ⇒ Boolean
22
23
24
25
26
27
|
# File 'lib/monkey_wrench/member.rb', line 22
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
|