| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::PS1::Plugin::Ruby; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # Created on: 2011-06-21 09:48:47 | 
| 4 |  |  |  |  |  |  | # Create by:  Ivan Wills | 
| 5 |  |  |  |  |  |  | # $Id$ | 
| 6 |  |  |  |  |  |  | # $Revision$, $HeadURL$, $Date$ | 
| 7 |  |  |  |  |  |  | # $Revision$, $Source$, $Date$ | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 1011 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 10 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 11 | 1 |  |  | 1 |  | 6 | use English qw/ -no_match_vars /; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | our $VERSION = 0.08; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub ruby { | 
| 16 | 0 |  |  | 0 | 1 |  | my ($self, $options) = @_; | 
| 17 | 0 |  |  |  |  |  | my $name = $ENV{RUBY_VERSION}; | 
| 18 | 0 | 0 |  |  |  |  | return if !$name; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 0 |  |  |  |  |  | my ($version) = $name =~ /^ruby-([\d.]+)/; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 0 | 0 |  |  |  |  | return if !$version; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 0 |  |  |  |  |  | return $self->surround( 5 + length $version, $self->colour('branch_label') . 'ruby ' . $self->colour('branch') . $version ); | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | 1; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | __END__ | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =head1 NAME | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | App::PS1::Plugin::Ruby - Shows current version of ruby if using rvm | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head1 VERSION | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | This documentation refers to App::PS1::Plugin::Ruby version 0.08. | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | use App::PS1::Plugin::Ruby; | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | # Brief but working code example(s) here showing the most common usage(s) | 
| 44 |  |  |  |  |  |  | # This section will be as far as many users bother reading, so make it as | 
| 45 |  |  |  |  |  |  | # educational and exemplary as possible. | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =head2 C<ruby ()> | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | Determines the current version of Ruby if using C<rvm>. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =head1 DIAGNOSTICS | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head1 CONFIGURATION AND ENVIRONMENT | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =head1 DEPENDENCIES | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 INCOMPATIBILITIES | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head1 BUGS AND LIMITATIONS | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | There are no known bugs in this module. | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | Please report problems to Ivan Wills (ivan.wills@gmail.com). | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | Patches are welcome. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =head1 AUTHOR | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | Ivan Wills - (ivan.wills@gmail.com) | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | Copyright (c) 2011 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). | 
| 79 |  |  |  |  |  |  | All rights reserved. | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | This module is free software; you can redistribute it and/or modify it under | 
| 82 |  |  |  |  |  |  | the same terms as Perl itself. See L<perlartistic>.  This program is | 
| 83 |  |  |  |  |  |  | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | 
| 84 |  |  |  |  |  |  | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 
| 85 |  |  |  |  |  |  | PARTICULAR PURPOSE. | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =cut |