Module: Yaks

Defined in:
lib/yaks.rb,
lib/yaks/util.rb,
lib/yaks/config.rb,
lib/yaks/errors.rb,
lib/yaks/format.rb,
lib/yaks/mapper.rb,
lib/yaks/runner.rb,
lib/yaks/builder.rb,
lib/yaks/version.rb,
lib/yaks/pipeline.rb,
lib/yaks/resource.rb,
lib/yaks/changelog.rb,
lib/yaks/format/hal.rb,
lib/yaks/reader/hal.rb,
lib/yaks/serializer.rb,
lib/yaks/format/halo.rb,
lib/yaks/fp/callable.rb,
lib/yaks/html5_forms.rb,
lib/yaks/mapper/form.rb,
lib/yaks/mapper/link.rb,
lib/yaks/primitivize.rb,
lib/yaks/configurable.rb,
lib/yaks/mapper/config.rb,
lib/yaks/null_resource.rb,
lib/yaks/resource/form.rb,
lib/yaks/resource/link.rb,
lib/yaks/default_policy.rb,
lib/yaks/mapper/has_one.rb,
lib/yaks/format/json_api.rb,
lib/yaks/mapper/has_many.rb,
lib/yaks/reader/json_api.rb,
lib/yaks/breaking_changes.rb,
lib/yaks/mapper/attribute.rb,
lib/yaks/collection_mapper.rb,
lib/yaks/mapper/form/field.rb,
lib/yaks/mapper/association.rb,
lib/yaks/mapper/form/config.rb,
lib/yaks/mapper/form/legend.rb,
lib/yaks/collection_resource.rb,
lib/yaks/resource/form/field.rb,
lib/yaks/resource/has_fields.rb,
lib/yaks/mapper/form/fieldset.rb,
lib/yaks/resource/form/legend.rb,
lib/yaks/format/collection_json.rb,
lib/yaks/resource/form/fieldset.rb,
lib/yaks/mapper/form/field/option.rb,
lib/yaks/mapper/association_mapper.rb,
lib/yaks/mapper/form/dynamic_field.rb,
lib/yaks/resource/form/field/option.rb,
lib/yaks/behaviour/optional_includes.rb

Defined Under Namespace

Modules: Behaviour, Changelog, Configurable, FP, HTML5Forms, Reader, Serializer, Util Classes: Builder, CollectionMapper, CollectionResource, Config, DefaultPolicy, Format, Mapper, NullResource, Pipeline, Primitivize, Resource, Runner

Constant Summary collapse

Undefined =
Module.new.freeze
Root =

Set the Root constant as the gems root path

Pathname(__FILE__).join('../..')
DSL_METHODS =
[
  :format_options,
  :rel_template,
  :mapper_for,
  :before,
  :after,
  :around,
  :skip,
  :namespace,
  :mapper_namespace,
  :serializer,
  :json_serializer,
  :map_to_primitive
]
ConfigBuilder =
Builder.new(Yaks::Config) do
  def_set(*Yaks::Config.attributes.names)
  def_forward(*DSL_METHODS)
  def_forward(*Yaks::DefaultPolicy.public_instance_methods(false))
end
Error =
Class.new(StandardError)
IllegalStateError =
Class.new(Error)
RuntimeError =
Class.new(Error)
UnsupportedOperationError =
Class.new(Error)
PrimitivizeError =
Class.new(Error)
VERSION =
'0.13.0'
BreakingChanges =

gem to aid upgraiding

{

  '0.7.6' => %q~
Breaking Changes in Yaks 0.7.6
==============================
Breaking change: using a symbol instead of link template no longer
works, use a lambda.

    link :foo, :bar

Becomes

    link :foo, ->{ bar }

Strictly speaking the equivalent version would be `link :foo, ->{
load_attribute(:bar) }`. Depending on if `bar` is implemented on the
mapper or is an attribute of the object, this would simplify to `link
:foo, ->{ bar }` or `link :foo, ->{ object.bar }` respectively.

The `href` attribute of a control has been renamed `action`, in line
with the attribute name in HTML. An alias is available but will output
a deprecation warning.
~,

  '0.7.0' => %q~
Breaking Changes in Yaks 0.7.0
==============================
Yaks::Resource#subresources is now an array, not a hash. The rel is
stored on the resource itself as Yaks::Resource#rels (an array). This
should only be of concern if you implement custom output formats

The general signature of all processing steps (mapper, formatter,
hooks) has changed to incldue a second parameter, the rack env. If you
have custom implementations of any of these, or hooks that are not
specified as ruby blocks, you will need to take this into account
~,

  '0.5.0' => %q~

Breaking Changes in Yaks 0.5.0
==============================

Yaks now serializes its output, you no longer have to convert to JSON
yourself. Use `skip :serialize' to get the old behavior, or
`json_serializer` to use a different JSON implementation.

The single `after' hook has been replaced with a set of `before',
`after', `around' and `skip' hooks.

If you've created your own subclass of `Yaks::Format' (previously:
`Yaks::Serializer'), then you need to update the call to
`Format.register'.

These are potentially breaking changes. See the CHANGELOG and README
for full documentation.

~,

  '0.4.3' => %q~

Breaking Changes in Yaks 0.4.3
==============================

Yaks::Mapper#filter was removed, if you override this method in your
mappers to conditionally filter attributes or associations, you will
have to override #attributes or #associations instead.

When specifying a rel_template, now a single {rel} placeholder is
expected instead of {src} and {dest}.

There are other internal changes. See the CHANGELOG and README for full
documentation.

~
}

Class Method Summary collapse

Class Method Details

.new(&blk) ⇒ Yaks::Config

Parameters:

  • blk (Proc)

Returns:



56
57
58
# File 'lib/yaks.rb', line 56

def new(&blk)
  ConfigBuilder.create(&blk)
end