Module: CommentStrip

Extended by:
CommentStrip
Includes:
Xqsr3::Quality::ParameterChecking
Included in:
CommentStrip
Defined in:
lib/comment_strip.rb,
lib/comment_strip/strip.rb,
lib/comment_strip/version.rb,
lib/comment_strip/language_families/c.rb

Overview

Main module for comment_strip.r library

Defined Under Namespace

Modules: LanguageFamilies

Constant Summary collapse

VERSION =

Current version of the comment_strip.r library

'0.1.2'
VERSION_MAJOR =

Major version of the comment_strip.r library

VERSION_PARTS_[0]
VERSION_MINOR =

# Minor version of the comment_strip.r library

VERSION_PARTS_[1]
VERSION_REVISION =

# Revision version of the comment_strip.r library

VERSION_PARTS_[2]

Instance Method Summary collapse

Instance Method Details

#strip(input, lf, **options) ⇒ Object

Strips comments from an input string, according to the rules and conventions of a given language-family

Signature

  • Parameters:

    • input (::String, nil) the input source code

    • lf (::String) the name of the language family. Currently only

      the value +'C'+ is accepted
      
    • options (::Hash) options that moderate the behaviour

  • Options:

None currently defined.

Signature

(String) The stripped for of the input.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/comment_strip/strip.rb', line 67

def strip input, lf, **options

    check_parameter input, 'input', responds_to: [ :each_char, :empty?, :nil?, ], nil: true
    check_parameter lf, 'lf', types: [ ::String, ::Symbol ]

    case lf.to_s.upcase
    when 'C'

        LanguageFamilies::C.strip input, lf, **options
    else

        raise "language family '#{lf}' unrecognised or not supported1"
    end
end