Sha256: a4edbcdbdb02916311adb50b591ade71e907f4164f92dc34907ae92814d37062

Contents?: true

Size: 364 Bytes

Versions: 22

Compression:

Stored size: 364 Bytes

Contents

# frozen_string_literal: true

class DummyModel
  class Decorator < Azeroth::Decorator
    expose :name
    expose :age
    expose :favorite_pokemon, as: :pokemon
    expose :errors, if: :invalid?

    def name
      [object.first_name, object.last_name].compact.join(' ')
    end

    def errors
      object.valid?
      object.errors.messages
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
azeroth-1.0.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.10.1 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.10.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.9.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.8.2 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.8.1 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.8.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.7.4 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.7.3 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.7.2 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.7.1 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.7.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.5 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.4 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.3 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.2 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.1 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.6.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.5.0 spec/dummy/app/models/dummy_model/decorator.rb
azeroth-0.4.0 spec/dummy/app/models/dummy_model/decorator.rb