Module: Plock
- Defined in:
- lib/plock.rb,
lib/plock/version.rb
Defined Under Namespace
Modules: Format
Constant Summary collapse
- VERSION =
"0.0.3"
Class Attribute Summary collapse
Class Method Summary collapse
- .format_with(inspect_method, block_source, block_result) ⇒ Object
- .inspect_block(attached = :inspect_block, &block) ⇒ Object
- .print_block_with(inspect_method, attached, &block) ⇒ Object
Class Attribute Details
.output_format ⇒ Object
15 16 17 |
# File 'lib/plock.rb', line 15 def output_format @output_format ||= self::Format::DEFAULT_FORMAT end |
Class Method Details
.format_with(inspect_method, block_source, block_result) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/plock.rb', line 30 def format_with inspect_method, block_source, block_result result = self.output_format.dup result.sub! self::Format::PERCENT_B, block_source result.sub! self::Format::PERCENT_R, block_result.__send__( inspect_method ) return result end |
.inspect_block(attached = :inspect_block, &block) ⇒ Object
19 20 21 22 |
# File 'lib/plock.rb', line 19 def inspect_block( attached = :inspect_block, &block ) result = block.call [ block.to_source( attached_to: attached, strip_enclosure: true ), result ] end |
.print_block_with(inspect_method, attached, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/plock.rb', line 24 def print_block_with inspect_method, attached, &block block_source, block_result = Plock.inspect_block( attached, &block ) puts self.format_with( inspect_method, block_source, block_result ) block_result end |