OFC2/ToolTip.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« OFC2/Title.pm ↑ Summary OFC2/Types.pm »
1 package Chart::OFC2::ToolTip;
2  
3 =head1 NAME
4  
5 Chart::OFC2::ToolTip - OFC2 tool tip settings object
6  
7 =head1 SYNOPSIS
8  
9 use Chart::OFC2;
10 use Chart::OFC2::Tooltip;
11
12 my $tooltip = Chart::OFC2::ToolTip->new(
13 'mouse' => 2,
14 'shadow' => 0,
15 'stroke' => 5,
16 'colour' => '#6E604F',
17 'background' => '#BDB396',
18 'title' => '{font-size: 14px; color: #CC2A43;}',
19 'body' => '{font-size: 10px; font-weight: bold; color: #000000;}',
20 );
21  
22 =head1 DESCRIPTION
23  
24 OFC2 tooltip settings.
25  
26 =cut
27  
28 0 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=2.6
29 use Moose::Util::TypeConstraints;
30 use MooseX::StrictConstructor;
31  
32 our $VERSION = '0.07';
33  
34 coerce 'Chart::OFC2::ToolTip'
35 => from 'HashRef'
36 => via { Chart::OFC2::ToolTip->new($_) };
37  
38 =head1 PROPERTIES
39  
40 has 'mouse' => (is => 'rw', isa => 'Int',);
41 has 'shadow' => (is => 'rw', isa => 'Bool', );
42 has 'stroke' => (is => 'rw', isa => 'Int',);
43 has 'colour' => (is => 'rw', isa => 'Str',);
44 has 'background' => (is => 'rw', isa => 'Str',);
45 has 'title' => (is => 'rw', isa => 'Str',);
46 has 'body' => (is => 'rw', isa => 'Str',);
47  
48 =cut
49  
50 has 'mouse' => (is => 'rw', isa => 'Int',);
51 has 'shadow' => (is => 'rw', isa => 'Bool', );
52 has 'stroke' => (is => 'rw', isa => 'Int',);
53 has 'colour' => (is => 'rw', isa => 'Str',);
54 has 'background' => (is => 'rw', isa => 'Str',);
55 has 'title' => (is => 'rw', isa => 'Str',);
56 has 'body' => (is => 'rw', isa => 'Str',);
57  
58 =head1 METHODS
59  
60 =head2 new()
61  
62 Object constructor.
63  
64 =head2 TO_JSON()
65  
66 Returns HashRef that is possible to give to C<encode_json()> function.
67  
68 =cut
69  
70 sub TO_JSON {
71 my $self = shift;
72
73 return {
74 map { my $v = $self->$_; (defined $v ? ($_ => $v) : ()) }
75 map { $_->name }
76 $self->meta->get_all_attributes
77 };
78 }
79  
80 __PACKAGE__->meta->make_immutable;
81  
82 1;
83  
84  
85 __END__
« OFC2/Title.pm ↑ Summary OFC2/Types.pm »