Module: Parliament::Grom::Decorator
- Defined in:
- lib/parliament/grom/decorator.rb,
lib/parliament/grom/decorator/house.rb,
lib/parliament/grom/decorator/party.rb,
lib/parliament/grom/decorator/gender.rb,
lib/parliament/grom/decorator/person.rb,
lib/parliament/grom/decorator/version.rb,
lib/parliament/grom/decorator/house_seat.rb,
lib/parliament/grom/decorator/incumbency.rb,
lib/parliament/grom/decorator/contact_point.rb,
lib/parliament/grom/decorator/postal_address.rb,
lib/parliament/grom/decorator/gender_identity.rb,
lib/parliament/grom/decorator/seat_incumbency.rb,
lib/parliament/grom/decorator/house_incumbency.rb,
lib/parliament/grom/decorator/party_membership.rb,
lib/parliament/grom/decorator/constituency_area.rb,
lib/parliament/grom/decorator/constituency_group.rb
Overview
Namespace for Grom decorators.
Defined Under Namespace
Modules: ConstituencyArea, ConstituencyGroup, ContactPoint, Gender, GenderIdentity, House, HouseIncumbency, HouseSeat, Incumbency, Party, PartyMembership, Person, PostalAddress, SeatIncumbency
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
-
.decorate(object) ⇒ Object
Decorates objects with alias methods extended from its decorator module.
Class Method Details
.decorate(object) ⇒ Object
Decorates objects with alias methods extended from its decorator module.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/parliament/grom/decorator.rb', line 28 def self.decorate(object) return object unless object.respond_to?(:type) object_type = ::Grom::Helper.get_id(object.type) return object unless constants.include?(object_type.to_sym) decorator_module = Object.const_get("Parliament::Grom::Decorator::#{object_type}") object.extend(decorator_module) end |