Class: AdLint::Cc1::PrintfFormat
- Inherits:
-
Object
- Object
- AdLint::Cc1::PrintfFormat
- Defined in:
- lib/adlint/cc1/format.rb
Instance Attribute Summary collapse
-
#directives ⇒ Object
readonly
Returns the value of attribute directives.
-
#extra_arguments ⇒ Object
readonly
Returns the value of attribute extra_arguments.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #conversion_specifiers ⇒ Object
-
#initialize(fmt_str, loc, trailing_args, env) ⇒ PrintfFormat
constructor
A new instance of PrintfFormat.
- #max_length ⇒ Object
- #min_length ⇒ Object
Constructor Details
#initialize(fmt_str, loc, trailing_args, env) ⇒ PrintfFormat
Returns a new instance of PrintfFormat.
38 39 40 41 42 |
# File 'lib/adlint/cc1/format.rb', line 38 def initialize(fmt_str, loc, trailing_args, env) @location = loc @directives = create_directives(fmt_str, trailing_args, env) @extra_arguments = trailing_args end |
Instance Attribute Details
#directives ⇒ Object (readonly)
Returns the value of attribute directives.
45 46 47 |
# File 'lib/adlint/cc1/format.rb', line 45 def directives @directives end |
#extra_arguments ⇒ Object (readonly)
Returns the value of attribute extra_arguments.
46 47 48 |
# File 'lib/adlint/cc1/format.rb', line 46 def extra_arguments @extra_arguments end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
44 45 46 |
# File 'lib/adlint/cc1/format.rb', line 44 def location @location end |
Instance Method Details
#conversion_specifiers ⇒ Object
48 49 50 |
# File 'lib/adlint/cc1/format.rb', line 48 def conversion_specifiers @directives.select { |dire| dire.conversion_specifier? } end |
#max_length ⇒ Object
56 57 58 |
# File 'lib/adlint/cc1/format.rb', line 56 def max_length @directives.reduce(0) { |len, dire| len + dire.max_length } end |
#min_length ⇒ Object
52 53 54 |
# File 'lib/adlint/cc1/format.rb', line 52 def min_length @directives.reduce(0) { |len, dire| len + dire.min_length } end |