Class: FlatMap::EmptyMapper

Inherits:
BaseMapper show all
Defined in:
lib/flat_map/empty_mapper.rb

Overview

EmptyMapper behaves in a very same way as targeted Mappers with only distinction of absence of required target. That makes them a platform for mounting other mappers and placing control structures of business logic.

Form more detailed information on what mappers are and their API refer to Mapper.

Instance Attribute Summary

Attributes inherited from BaseMapper

#host, #name, #owner, #suffix, #traits

Instance Method Summary collapse

Methods inherited from BaseMapper

#hosted?, inherited, #inspect, #owned?, #suffixed?

Methods included from BaseMapper::Skipping

#save, #shallow_save, #skip!, #skipped?, #use!, #valid?, #write

Methods included from BaseMapper::Persistence

#apply, #errors, #save, #shallow_save, #valid?, #write

Methods included from BaseMapper::AttributeMethods

#method_missing

Methods included from BaseMapper::Traits

#extension, #extension?, #mountings, #self_mountings, #trait

Methods included from BaseMapper::Mounting

#after_save_mountings, #before_save_mountings, #method_missing, #mounting, #mountings, #nearest_mountings, #read, #write

Methods included from BaseMapper::Mapping

#[], #[]=, #mapping, #read, #write

Constructor Details

#initialize(*traits) ⇒ EmptyMapper

Initializes mapper with traits, which are used to fetch proper list of mounted mappers.

Parameters:

  • traits (*Symbol)

    List of traits



14
15
16
17
18
19
20
# File 'lib/flat_map/empty_mapper.rb', line 14

def initialize(*traits)
  @traits = traits

  if block_given?
    singleton_class.trait :extension, &Proc.new
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FlatMap::BaseMapper::AttributeMethods

Instance Method Details

#save_targettrue

Return true since there’s no target.

Returns:

  • (true)


25
26
27
# File 'lib/flat_map/empty_mapper.rb', line 25

def save_target
  true
end