Class: Nero::BaseTag
Direct Known Subclasses
Instance Attribute Summary collapse
-
#coder ⇒ Object
readonly
Returns the value of attribute coder.
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #args ⇒ Object
- #config ⇒ Object
- #init(ctx:, options:) ⇒ Object
- #init_ctx(ctx) ⇒ Object
- #init_options(**options) ⇒ Object
-
#init_with(coder) ⇒ Object
used by YAML.
- #resolve ⇒ Object
- #tag_name ⇒ Object
Methods included from Resolvable
#deep_resolve, #gen_resolve_tryer, #resolve_nested!, #try_resolve
Instance Attribute Details
permalink #coder ⇒ Object (readonly)
Returns the value of attribute coder.
77 78 79 |
# File 'lib/nero.rb', line 77 def coder @coder end |
permalink #ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
77 78 79 |
# File 'lib/nero.rb', line 77 def ctx @ctx end |
permalink #options ⇒ Object (readonly)
Returns the value of attribute options.
77 78 79 |
# File 'lib/nero.rb', line 77 def end |
Class Method Details
permalink .[](**options) ⇒ Object
[View source] [View on GitHub]
79 80 81 |
# File 'lib/nero.rb', line 79 def self.[](**) [self, ] end |
Instance Method Details
permalink #args ⇒ Object
[View source] [View on GitHub]
105 106 107 108 109 110 111 112 113 114 |
# File 'lib/nero.rb', line 105 def args @args ||= begin resolve_nested!(coder, {}) case coder.type when :map then Util.deep_symbolize_keys(coder.map) else Array(coder.public_send(coder.type)) end end end |
permalink #config ⇒ Object
[View source] [View on GitHub]
116 117 118 |
# File 'lib/nero.rb', line 116 def config ctx.dig(:tags, tag_name) end |
permalink #init(ctx:, options:) ⇒ Object
[View source] [View on GitHub]
88 89 90 91 |
# File 'lib/nero.rb', line 88 def init(ctx:, options:) init_ctx(ctx) (**) end |
permalink #init_ctx(ctx) ⇒ Object
[View source] [View on GitHub]
93 94 95 |
# File 'lib/nero.rb', line 93 def init_ctx(ctx) @ctx = ctx end |
permalink #init_options(**options) ⇒ Object
[View source] [View on GitHub]
97 98 99 |
# File 'lib/nero.rb', line 97 def (**) = end |
permalink #init_with(coder) ⇒ Object
used by YAML
84 85 86 |
# File 'lib/nero.rb', line 84 def init_with(coder) @coder = coder end |
permalink #resolve ⇒ Object
[View source] [View on GitHub]
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/nero.rb', line 120 def resolve(**) if (block = config[:block]) if block.parameters.map(&:last).include?(:coder) # legacy block.call(coder, ctx) else block.call(self) end else args end end |
permalink #tag_name ⇒ Object
[View source] [View on GitHub]
101 102 103 |
# File 'lib/nero.rb', line 101 def tag_name coder.tag[1..] end |