Class: PuppetStrings::Markdown::Function
- Defined in:
- lib/puppet-strings/markdown/function.rb
Overview
Generates Markdown for a Puppet Function.
Defined Under Namespace
Classes: Signature
Instance Attribute Summary collapse
-
#signatures ⇒ Object
readonly
Returns the value of attribute signatures.
Instance Method Summary collapse
- #error_text(text) ⇒ Object
- #error_type(type) ⇒ Object
-
#initialize(registry) ⇒ Function
constructor
A new instance of Function.
- #render ⇒ Object
- #type ⇒ Object
Methods inherited from Base
#defaults, #enums, #enums_for_param, #examples, group_name, items, #link, #name, #options, #options_for_param, #params, #private?, #raises, #return_type, #see, #since, #text, #toc_info, #word_wrap, yard_types
Methods included from Helpers
Constructor Details
#initialize(registry) ⇒ Function
Returns a new instance of Function.
13 14 15 16 17 18 19 20 |
# File 'lib/puppet-strings/markdown/function.rb', line 13 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.
8 9 10 |
# File 'lib/puppet-strings/markdown/function.rb', line 8 def signatures @signatures end |
Instance Method Details
#error_text(text) ⇒ Object
43 44 45 |
# File 'lib/puppet-strings/markdown/function.rb', line 43 def error_text(text) text.split.drop(1).join(' ').to_s end |
#error_type(type) ⇒ Object
39 40 41 |
# File 'lib/puppet-strings/markdown/function.rb', line 39 def error_type(type) "`#{type.split[0]}`" end |
#render ⇒ Object
22 23 24 |
# File 'lib/puppet-strings/markdown/function.rb', line 22 def render super(@template) end |
#type ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/puppet-strings/markdown/function.rb', line 26 def type t = @registry[:type] if t.include?('ruby4x') 'Ruby 4.x API' elsif t.include?('ruby3') 'Ruby 3.x API' elsif t.include?('ruby') 'Ruby' else 'Puppet Language' end end |