Sha256: 632d959c8e4f647c4c628cbdf9c5ab9b441e1290585ef41bf3f8af1e4a4bba53
Contents?: true
Size: 932 Bytes
Versions: 7
Compression:
Stored size: 932 Bytes
Contents
module Praxis class MediaType < Praxis::Blueprint class DSLCompiler < Attributor::DSLCompiler def links(&block) attribute :links, Praxis::Links.for(options[:reference]), dsl_compiler: Links::DSLCompiler, &block end end def self.description(text=nil) @description = text if text @description end def self.identifier(identifier=nil) return @identifier unless identifier # TODO: parse the string and extract things like collection , and format type?... @identifier = identifier end def self.describe(shallow = false) hash = super unless shallow hash.merge!(identifier: @identifier, description: @description) end hash end def self.attributes(opts={}, &block) super(opts.merge(dsl_compiler: MediaType::DSLCompiler), &block) end def links self.class::Links.new(@object) end end end
Version data entries
7 entries across 7 versions & 1 rubygems