Class: Workarea::Search::UserText
- Inherits:
-
Object
- Object
- Workarea::Search::UserText
- Defined in:
- app/models/workarea/search/user_text.rb
Instance Method Summary collapse
- #addresses_text ⇒ Object
-
#initialize(user) ⇒ UserText
constructor
A new instance of UserText.
- #text ⇒ Object
- #type_text ⇒ Object
Constructor Details
#initialize(user) ⇒ UserText
Returns a new instance of UserText.
4 5 6 |
# File 'app/models/workarea/search/user_text.rb', line 4 def initialize(user) @user = user end |
Instance Method Details
#addresses_text ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/workarea/search/user_text.rb', line 20 def addresses_text (@user.addresses || []).map do |address| [ address.street, address.street_2, address.city, address.region, address.region_name, address.postal_code, address.country.name, address.country.alpha2, address.phone_number ].join(' ') end end |
#text ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/workarea/search/user_text.rb', line 8 def text [ 'user people', @user.email, @user.first_name, @user.last_name, @user., addresses_text, type_text ].flatten.join(' ') end |
#type_text ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/models/workarea/search/user_text.rb', line 36 def type_text if @user.admin? 'admin administrator' else 'customer' end end |