Class: Harbinger::Reporters::UserReporter
- Inherits:
-
Object
- Object
- Harbinger::Reporters::UserReporter
- Defined in:
- lib/harbinger/reporters/user_reporter.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #accept(message) ⇒ Object
-
#initialize(user, config = {}) ⇒ UserReporter
constructor
A new instance of UserReporter.
Constructor Details
#initialize(user, config = {}) ⇒ UserReporter
Returns a new instance of UserReporter.
6 7 8 9 |
# File 'lib/harbinger/reporters/user_reporter.rb', line 6 def initialize(user, config = {}) @user = user @method_names = config.fetch(:method_names) { ['username'] } end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/harbinger/reporters/user_reporter.rb', line 3 def user @user end |
Instance Method Details
#accept(message) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/harbinger/reporters/user_reporter.rb', line 11 def accept() method_names.each do |method_name| if user.respond_to?(method_name) .append('user', method_name, user.public_send(method_name)) end end end |