Class: PuppetStrings::Markdown::Function
- Defined in:
- lib/puppet-strings/markdown/function.rb
Defined Under Namespace
Classes: Signature
Instance Attribute Summary collapse
-
#signatures ⇒ Object
readonly
Returns the value of attribute signatures.
Instance Method Summary collapse
- #error_text(r) ⇒ Object
- #error_type(r) ⇒ Object
-
#initialize(registry) ⇒ Function
constructor
A new instance of Function.
- #render ⇒ Object
- #type ⇒ Object
Methods inherited from Base
#defaults, #examples, #link, #name, #options, #options_for_param, #params, #private?, #raises, #return_type, #see, #since, #text, #toc_info, #value_string
Constructor Details
#initialize(registry) ⇒ Function
Returns a new instance of Function.
7 8 9 10 11 12 13 14 |
# File 'lib/puppet-strings/markdown/function.rb', line 7 def initialize(registry) @template = 'function.erb' super(registry, 'function') @signatures = [] registry[:signatures].each do |sig| @signatures.push(Signature.new(sig)) end end |
Instance Attribute Details
#signatures ⇒ Object (readonly)
Returns the value of attribute signatures.
5 6 7 |
# File 'lib/puppet-strings/markdown/function.rb', line 5 def signatures @signatures end |
Instance Method Details
#error_text(r) ⇒ Object
37 38 39 |
# File 'lib/puppet-strings/markdown/function.rb', line 37 def error_text(r) "#{r.split(' ').drop(1).join(' ')}" end |
#error_type(r) ⇒ Object
33 34 35 |
# File 'lib/puppet-strings/markdown/function.rb', line 33 def error_type(r) "`#{r.split(' ')[0]}`" end |
#render ⇒ Object
16 17 18 |
# File 'lib/puppet-strings/markdown/function.rb', line 16 def render super(@template) end |
#type ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/puppet-strings/markdown/function.rb', line 20 def type t = @registry[:type] if t =~ /ruby4x/ "Ruby 4.x API" elsif t =~ /ruby3/ "Ruby 3.x API" elsif t =~ /ruby/ "Ruby" else "Puppet Language" end end |