Class: PuppetX::PuppetLabs::Strings::Pops::YARDStatement
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- PuppetX::PuppetLabs::Strings::Pops::YARDStatement
- Defined in:
- lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb
Overview
An adapter class that conforms a Pops model instance + adapters to the interface expected by YARD handlers.
FIXME: Inhertiting from OpenStruct is a bit of a hack. It allows attributes to be declared as needed but in the long run understandibility of the code would be improved by having a concrete model.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#pops_obj ⇒ Object
readonly
Returns the value of attribute pops_obj.
Instance Method Summary collapse
- #comments_hash_flag ⇒ Object
- #comments_range ⇒ Object
-
#initialize(pops_obj) ⇒ YARDStatement
constructor
A new instance of YARDStatement.
- #line ⇒ Object
- #source ⇒ Object (also: #show)
- #type ⇒ Object
Constructor Details
#initialize(pops_obj) ⇒ YARDStatement
Returns a new instance of YARDStatement.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 12 def initialize(pops_obj) # Initialize OpenStruct super({}) unless pops_obj.is_a? Puppet::Pops::Model::PopsObject raise ArgumentError, "A YARDStatement can only be initialized from a PopsObject. Got a: #{pops_obj.class}" end @pops_obj = pops_obj @pos_adapter = Puppet::Pops::Adapters::SourcePosAdapter.adapt(@pops_obj) # FIXME: Perhaps this should be a seperate adapter? @comments = extract_comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
10 11 12 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 10 def comments @comments end |
#pops_obj ⇒ Object (readonly)
Returns the value of attribute pops_obj.
10 11 12 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 10 def pops_obj @pops_obj end |
Instance Method Details
#comments_hash_flag ⇒ Object
42 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 42 def comments_hash_flag; nil end |
#comments_range ⇒ Object
43 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 43 def comments_range; nil end |
#line ⇒ Object
30 31 32 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 30 def line @line ||= @pos_adapter.line end |
#source ⇒ Object Also known as: show
34 35 36 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 34 def source @source ||= @pos_adapter.extract_text end |
#type ⇒ Object
26 27 28 |
# File 'lib/puppet_x/puppetlabs/strings/pops/yard_statement.rb', line 26 def type pops_obj.class end |