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(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, #link, #name, #options, #options_for_param, #params, #private?, #raises, #return_type, #see, #since, #text, #toc_info, #value_string, #word_wrap
Constructor Details
#initialize(registry) ⇒ Function
Returns a new instance of Function.
9 10 11 12 13 14 15 16 |
# File 'lib/puppet-strings/markdown/function.rb', line 9 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.
7 8 9 |
# File 'lib/puppet-strings/markdown/function.rb', line 7 def signatures @signatures end |
Instance Method Details
#error_text(text) ⇒ Object
39 40 41 |
# File 'lib/puppet-strings/markdown/function.rb', line 39 def error_text(text) "#{text.split(' ').drop(1).join(' ')}" end |
#error_type(type) ⇒ Object
35 36 37 |
# File 'lib/puppet-strings/markdown/function.rb', line 35 def error_type(type) "`#{type.split(' ')[0]}`" end |
#render ⇒ Object
18 19 20 |
# File 'lib/puppet-strings/markdown/function.rb', line 18 def render super(@template) end |
#type ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/puppet-strings/markdown/function.rb', line 22 def type t = @registry[:type] if /ruby4x/.match?(t) "Ruby 4.x API" elsif /ruby3/.match?(t) "Ruby 3.x API" elsif /ruby/.match?(t) "Ruby" else "Puppet Language" end end |