lib/yaks/mapper.rb in yaks-0.7.7 vs lib/yaks/mapper.rb in yaks-0.8.0.alpha
- old
+ new
@@ -1,17 +1,25 @@
-# -*- coding: utf-8 -*-
-
module Yaks
class Mapper
- extend ClassMethods, Forwardable
- include Util, FP, FP::Callable
+ extend Configurable
- def_delegators 'self.class', :config
- def_delegators :config, :attributes, :links, :associations, :forms
+ def_forward :type => :with_type
+ def_forward :attributes => :add_attributes
+ def_forward :append_to
- config Config.new
+ def_add :link, create: Link, append_to: :links
+ def_add :has_one, create: HasOne, append_to: :associations
+ def_add :has_many, create: HasMany, append_to: :associations
+ def_add :attribute, create: Attribute, append_to: :attributes
+ def_add :form, create: Form, append_to: :forms
+ extend Forwardable
+ include Util, FP, FP::Callable
+
attr_reader :object, :context
+
+ def_delegators 'self.class', :config
+ def_delegators :config, :attributes, :links, :associations, :forms
def initialize(context)
@context = context
end