Class: Praxis::Links::DSLCompiler
- Inherits:
-
Attributor::DSLCompiler
- Object
- Attributor::DSLCompiler
- Praxis::Links::DSLCompiler
- Defined in:
- lib/praxis/links.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
-
#initialize(target, dsl_compiler_options: {}, **options) ⇒ DSLCompiler
constructor
A new instance of DSLCompiler.
- #link(name, type = nil, using: name, **opts, &block) ⇒ Object
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:{}, **) @links = [:links] super end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
7 8 9 |
# File 'lib/praxis/links.rb', line 7 def links @links end |
Instance Method Details
#link(name, type = nil, using: name, **opts, &block) ⇒ Object
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 = [:reference].attributes[using].type end attribute(name, type, **opts, &block) end |