Class: Praxis::Links::DSLCompiler

Inherits:
Attributor::DSLCompiler
  • Object
show all
Defined in:
lib/praxis/links.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, dsl_compiler_options: {}, **options) ⇒ DSLCompiler

Returns a new instance of DSLCompiler.



8
9
10
11
12
# File 'lib/praxis/links.rb', line 8

def initialize(target, dsl_compiler_options:{}, **options)
  @links = dsl_compiler_options[:links]

  super
end

Instance Attribute Details

Returns the value of attribute links.



7
8
9
# File 'lib/praxis/links.rb', line 7

def links
  @links
end

Instance Method Details



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

def link(name, type=nil, using: name, **opts, &block)
  links[name] = using
  if type.nil? && (name != using)
    type = options[:reference].attributes[using].type
  end
  attribute(name, type, **opts, &block)
end