Class: Pwl::Presenter::Json
- Inherits:
-
Object
- Object
- Pwl::Presenter::Json
- Defined in:
- lib/pwl/presenter/json.rb
Instance Method Summary collapse
-
#initialize(locker) ⇒ Json
constructor
A new instance of Json.
- #to_s ⇒ Object
Constructor Details
#initialize(locker) ⇒ Json
Returns a new instance of Json.
4 5 6 |
# File 'lib/pwl/presenter/json.rb', line 4 def initialize(locker) @locker = locker end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/pwl/presenter/json.rb', line 8 def to_s result = {} %w[created last_accessed last_modified].each do |attr| result.store(attr.to_sym, @locker.send(attr)) end result[:entries] = @locker.all.collect{|e| {:uuid => e.uuid, :name => e.name, :password => e.password}} result.to_json end |