Module: ShibRack::AttributeMapping
- Defined in:
- lib/shib_rack/attribute_mapping.rb
Overview
Mixin which provides helper methods for mapping attributes from Rack’s ‘env`
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
35 36 37 38 |
# File 'lib/shib_rack/attribute_mapping.rb', line 35 def self.included(base) base.extend(ClassMethods) base.attribute_mappings = {} end |
Instance Method Details
#map_attributes(env) ⇒ Object
40 41 42 43 44 |
# File 'lib/shib_rack/attribute_mapping.rb', line 40 def map_attributes(env) self.class.attribute_mappings.reduce({}) do |out, (attr, mapper)| out.merge(attr => mapper.call(env)) end end |