active_object 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +120 -120
- data/lib/active_object/numeric.rb +90 -90
- data/lib/active_object/version.rb +1 -1
- data/spec/lib/numeric_spec.rb +120 -120
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c35a60abef56e9ea9870c84558acaac13aa28ac
|
4
|
+
data.tar.gz: 09f6b138d6cb164223cb7ebe9a92646a928ca52e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d6d2c9eb4fe5c059c75394453b32c421f41632049d73779b18661b4132ee649e38bf38887b3e5c51d3757f51f9fc73a54fc9c0e3bb2269b423e77046080b46e
|
7
|
+
data.tar.gz: 78eff913f5c5cd9bcb2389d8c19a48370516be2b9311224f7182fb60907645c0d1d3bdea3990ba3a698d12050c24c1053c9cec8ffa14c78afab88fe3a6f63f32
|
data/README.md
CHANGED
@@ -470,73 +470,73 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
470
470
|
4.add(2) #=> 6
|
471
471
|
```
|
472
472
|
|
473
|
-
####Bytes:####
|
474
|
-
`
|
473
|
+
####Bytes in Bytes:####
|
474
|
+
`byte_in_bytes` and `bytes_in_bytes` returns self.
|
475
475
|
|
476
476
|
```ruby
|
477
|
-
3.
|
477
|
+
3.bytes_in_bytes #=> 3
|
478
478
|
```
|
479
479
|
|
480
|
-
####Centigrams:####
|
481
|
-
`
|
480
|
+
####Centigrams in Grams:####
|
481
|
+
`centigram_in_grams` and `centigrams_in_grams` returns the amount of grams in n centigrams.
|
482
482
|
|
483
483
|
```ruby
|
484
|
-
3.
|
484
|
+
3.centigrams_in_grams #=> 0.03
|
485
485
|
```
|
486
486
|
|
487
|
-
####Centimeters:####
|
488
|
-
`
|
487
|
+
####Centimeters in Meters:####
|
488
|
+
`centimeter_in_meters` and `centimeters_in_meters` returns the amount of meters in n centimeters.
|
489
489
|
|
490
490
|
```ruby
|
491
|
-
3.
|
491
|
+
3.centimeters_in_meters #=> 0.03
|
492
492
|
```
|
493
493
|
|
494
|
-
####
|
495
|
-
`
|
494
|
+
####Centuries_in_seconds:####
|
495
|
+
`century_in_seconds` and `centuries_in_seconds` returns the amount of seconds in n centuries.
|
496
496
|
|
497
497
|
```ruby
|
498
|
-
3.
|
498
|
+
3.centuries_in_seconds #=> 9467280000.0
|
499
499
|
```
|
500
500
|
|
501
|
-
####Decades:####
|
502
|
-
`
|
501
|
+
####Decades in Seconds:####
|
502
|
+
`decade_in_seconds` and `decades_in_seconds` returns the amount of seconds in n decades.
|
503
503
|
|
504
504
|
```ruby
|
505
|
-
3.
|
505
|
+
3.decades_in_seconds #=> 946728000.0
|
506
506
|
```
|
507
|
-
####Decagrams:####
|
508
|
-
`
|
507
|
+
####Decagrams in Grams:####
|
508
|
+
`decagram_in_grams` and `decagrams_in_grams` returns the amount of grams in n decagrams.
|
509
509
|
|
510
510
|
```ruby
|
511
|
-
3.
|
511
|
+
3.decagrams_in_grams #=> 30
|
512
512
|
```
|
513
513
|
|
514
|
-
####Decameters:####
|
515
|
-
`
|
514
|
+
####Decameters in Meters:####
|
515
|
+
`decameter_in_meters` and `decameters_in_meters` returns the amount of meters in n decameters.
|
516
516
|
|
517
517
|
```ruby
|
518
|
-
3.
|
518
|
+
3.decameters_in_meters #=> 30
|
519
519
|
```
|
520
520
|
|
521
|
-
####Decigrams:####
|
522
|
-
`
|
521
|
+
####Decigrams in Grams:####
|
522
|
+
`decigram_in_grams` and `decigrams_in_grams` returns the amount of grams in n decigrams.
|
523
523
|
|
524
524
|
```ruby
|
525
|
-
3.
|
525
|
+
3.decigrams_in_grams #=> 0.3
|
526
526
|
```
|
527
527
|
|
528
|
-
####Decimeters:####
|
529
|
-
`
|
528
|
+
####Decimeters in Meters:####
|
529
|
+
`decimeter_in_meters` and `decimeters_in_meters` returns the amount of meters in n decimeters.
|
530
530
|
|
531
531
|
```ruby
|
532
|
-
3.
|
532
|
+
3.decimeters_in_meters #=> 0.3
|
533
533
|
```
|
534
534
|
|
535
|
-
####Days:####
|
536
|
-
`
|
535
|
+
####Days in Seconds:####
|
536
|
+
`day_in_seconds` and `days_in_seconds` returns the amount of seconds in n days.
|
537
537
|
|
538
538
|
```ruby
|
539
|
-
3.
|
539
|
+
3.days_in_seconds #=> 259200
|
540
540
|
```
|
541
541
|
|
542
542
|
####Divide:####
|
@@ -546,137 +546,137 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
546
546
|
4.divide(2) #=> 2
|
547
547
|
```
|
548
548
|
|
549
|
-
####Exabytes:####
|
550
|
-
`
|
549
|
+
####Exabytes in Bytes:####
|
550
|
+
`exabyte_in_bytes` and `exabytes_in_bytes` returns the amount of bytes in n exabytes.
|
551
551
|
|
552
552
|
```ruby
|
553
|
-
3.
|
553
|
+
3.exabytes_in_bytes #=> 3458764513820540928
|
554
554
|
```
|
555
555
|
|
556
|
-
####Feet:####
|
557
|
-
`
|
556
|
+
####Feet in Inches:####
|
557
|
+
`foot_in_inches` and `feet_in_inches` returns the amount of inches in n feet.
|
558
558
|
|
559
559
|
```ruby
|
560
|
-
3.
|
560
|
+
3.feet_in_inches #=> 36
|
561
561
|
```
|
562
562
|
|
563
|
-
####Gigabytes:####
|
564
|
-
`
|
563
|
+
####Gigabytes in Bytes:####
|
564
|
+
`gigabyte_in_bytes` and `gigabytes_in_bytes` returns the amount of bytes in n gigabytes.
|
565
565
|
|
566
566
|
```ruby
|
567
|
-
3.
|
567
|
+
3.gigabytes_in_bytes #=> 3221225472
|
568
568
|
```
|
569
569
|
|
570
|
-
####Grams:####
|
571
|
-
`
|
570
|
+
####Grams in Grams:####
|
571
|
+
`gram_in_grams` and `grams_in_grams` returns self.
|
572
572
|
|
573
573
|
```ruby
|
574
|
-
3.
|
574
|
+
3.grams_in_grams #=> 3
|
575
575
|
```
|
576
576
|
|
577
|
-
####Hectograms:####
|
578
|
-
`
|
577
|
+
####Hectograms in Grams:####
|
578
|
+
`hectogram_in_grams` and `hectograms_in_grams` returns the amount of grams in n hectograms.
|
579
579
|
|
580
580
|
```ruby
|
581
|
-
3.
|
581
|
+
3.hectograms_in_grams #=> 300
|
582
582
|
```
|
583
583
|
|
584
|
-
####Hectometers:####
|
585
|
-
`
|
584
|
+
####Hectometers in Meters:####
|
585
|
+
`hectometer_in_meters` and `hectometers_in_meters` returns the amount of meters in n hectometers.
|
586
586
|
|
587
587
|
```ruby
|
588
|
-
3.
|
588
|
+
3.hectometers_in_meters #=> 300
|
589
589
|
```
|
590
590
|
|
591
|
-
####Hours:####
|
592
|
-
`
|
591
|
+
####Hours in Seconds:####
|
592
|
+
`hour_in_seconds` and `hours_in_seconds` returns the amount of seconds in n hours.
|
593
593
|
|
594
594
|
```ruby
|
595
|
-
3.
|
595
|
+
3.hours_in_seconds #=> 10800
|
596
596
|
```
|
597
597
|
|
598
|
-
####Inches:####
|
599
|
-
`
|
598
|
+
####Inches in Inches:####
|
599
|
+
`inch_in_inches` and `inches_in_inches` returns the amount of inches in n inches.
|
600
600
|
|
601
601
|
```ruby
|
602
|
-
3.
|
602
|
+
3.inches_in_inches #=> 3
|
603
603
|
```
|
604
604
|
|
605
|
-
####Kilobytes:####
|
606
|
-
`
|
605
|
+
####Kilobytes in Bytes:####
|
606
|
+
`kilobyte_in_bytes` and `kilobytes_in_bytes` returns the amount of bytes in n kilobytes.
|
607
607
|
|
608
608
|
```ruby
|
609
|
-
3.
|
609
|
+
3.kilobytes_in_bytes #=> 3072
|
610
610
|
```
|
611
611
|
|
612
|
-
####Kilograms:####
|
613
|
-
`
|
612
|
+
####Kilograms in Grams:####
|
613
|
+
`kilogram_in_grams` and `kilograms_in_grams` returns the amount of grams in n kilograms.
|
614
614
|
|
615
615
|
```ruby
|
616
|
-
3.
|
616
|
+
3.kilograms_in_grams #=> 3000
|
617
617
|
```
|
618
618
|
|
619
|
-
####Kilometers:####
|
620
|
-
`
|
619
|
+
####Kilometers in Meters:####
|
620
|
+
`kilometer_in_meters` and `kilometers_in_meters` returns the amount of meters in n kilometers.
|
621
621
|
|
622
622
|
```ruby
|
623
|
-
3.
|
623
|
+
3.kilometers_in_meters #=> 3000
|
624
624
|
```
|
625
625
|
|
626
|
-
####Metric Ton:####
|
627
|
-
`
|
626
|
+
####Metric Ton in Ounces:####
|
627
|
+
`metric_ton_in_ounces` and `metric_tons_in_ounces` returns the amount of grams in n metric_tons.
|
628
628
|
|
629
629
|
```ruby
|
630
|
-
3.
|
630
|
+
3.metric_tons_in_ounces #=> 3000000
|
631
631
|
```
|
632
632
|
|
633
|
-
####Megabytes:####
|
634
|
-
`
|
633
|
+
####Megabytes in Bytes:####
|
634
|
+
`megabyte_in_bytes` and `megabytes_in_bytes` returns the amount of bytes in n megabytes.
|
635
635
|
|
636
636
|
```ruby
|
637
|
-
3.
|
637
|
+
3.megabytes_in_bytes #=> 3145728
|
638
638
|
```
|
639
639
|
|
640
|
-
####Meters:####
|
641
|
-
`
|
640
|
+
####Meters in Meters:####
|
641
|
+
`meter_in_meters` and `meters_in_meters` returns self.
|
642
642
|
|
643
643
|
```ruby
|
644
|
-
3.
|
644
|
+
3.meters_in_meters #=> 3
|
645
645
|
```
|
646
646
|
|
647
|
-
####Miles:####
|
648
|
-
`
|
647
|
+
####Miles in Inches:####
|
648
|
+
`mile_in_inches` and `miles_in_inches` returns the amount of inches in n miles.
|
649
649
|
|
650
650
|
```ruby
|
651
|
-
3.
|
651
|
+
3.miles_in_inches #=> 190080
|
652
652
|
```
|
653
653
|
|
654
|
-
####
|
655
|
-
`
|
654
|
+
####Millenniums in Seconds:####
|
655
|
+
`millennium_in_seconds` and `millenniums_in_seconds` returns the amount of seconds in n millenniums.
|
656
656
|
|
657
657
|
```ruby
|
658
|
-
3.
|
658
|
+
3.millenniums_in_seconds #=> 94672800000.0
|
659
659
|
```
|
660
660
|
|
661
|
-
####
|
662
|
-
`
|
661
|
+
####Milligrams in Grams:####
|
662
|
+
`milligram_in_grams` and `milligrams_in_grams` returns the amount of grams in n milligrams.
|
663
663
|
|
664
664
|
```ruby
|
665
|
-
3.
|
665
|
+
3.milligrams_in_grams #=> 0.003
|
666
666
|
```
|
667
667
|
|
668
|
-
####Millimeters:####
|
669
|
-
`
|
668
|
+
####Millimeters in Meters:####
|
669
|
+
`millimeter_in_meters` and `millimeters_in_meters` returns the amount of meters in n millimeters.
|
670
670
|
|
671
671
|
```ruby
|
672
|
-
3.
|
672
|
+
3.millimeters_in_meters #=> 0.003
|
673
673
|
```
|
674
674
|
|
675
|
-
####Minutes:####
|
676
|
-
`
|
675
|
+
####Minutes in Seconds:####
|
676
|
+
`minute_in_seconds` and `minutes_in_seconds` returns the amount of seconds in n minutes.
|
677
677
|
|
678
678
|
```ruby
|
679
|
-
3.
|
679
|
+
3.minutes_in_seconds #=> 180
|
680
680
|
```
|
681
681
|
|
682
682
|
####Multiply:####
|
@@ -694,11 +694,11 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
694
694
|
7.multiple_of?(3) #=> false
|
695
695
|
```
|
696
696
|
|
697
|
-
####Nautical Miles:####
|
698
|
-
`
|
697
|
+
####Nautical Miles in Inches:####
|
698
|
+
`nautical_mile_in_inches` and `nautical_miles_in_inches` returns the amount of inches in n nautical miles.
|
699
699
|
|
700
700
|
```ruby
|
701
|
-
3.
|
701
|
+
3.nautical_miles_in_inches #=> 218740.26239999998
|
702
702
|
```
|
703
703
|
|
704
704
|
####Negative:####
|
@@ -729,11 +729,11 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
729
729
|
"11".ordinalize #=> "4th"
|
730
730
|
```
|
731
731
|
|
732
|
-
####Ounces:####
|
733
|
-
`
|
732
|
+
####Ounces in Ounces:####
|
733
|
+
`ounce_in_ounces` and `ounces_in_ounces` returns self.
|
734
734
|
|
735
735
|
```ruby
|
736
|
-
3.
|
736
|
+
3.ounces_in_ounces #=> 48
|
737
737
|
```
|
738
738
|
|
739
739
|
####Pad:####
|
@@ -759,11 +759,11 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
759
759
|
3.pad_precision(pad_number: 1) #=> "3.11"
|
760
760
|
```
|
761
761
|
|
762
|
-
####Petabytes:####
|
763
|
-
`
|
762
|
+
####Petabytes in Bytes:####
|
763
|
+
`petabyte_in_bytes` and `pegabytes_in_bytes` returns the amount of bytes in n petabytes.
|
764
764
|
|
765
765
|
```ruby
|
766
|
-
3.
|
766
|
+
3.petabytes_in_bytes #=> 3377699720527872
|
767
767
|
```
|
768
768
|
|
769
769
|
####Positive:####
|
@@ -774,11 +774,11 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
774
774
|
-1.positive? #=> false
|
775
775
|
```
|
776
776
|
|
777
|
-
####Pounds:####
|
778
|
-
`
|
777
|
+
####Pounds in Ounces:####
|
778
|
+
`pound_in_ounces` and `pounds_in_ounces` returns the amount of ounces in n pounds.
|
779
779
|
|
780
780
|
```ruby
|
781
|
-
3.
|
781
|
+
3.pounds_in_ounces #=> 48
|
782
782
|
```
|
783
783
|
|
784
784
|
####Power:####
|
@@ -795,18 +795,18 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
795
795
|
4.root(2) #=> 2
|
796
796
|
```
|
797
797
|
|
798
|
-
####Seconds:####
|
799
|
-
`
|
798
|
+
####Seconds in Seconds:####
|
799
|
+
`second_in_seconds` and `seconds_in_seconds` returns self.
|
800
800
|
|
801
801
|
```ruby
|
802
802
|
3.seconds #=> 3
|
803
803
|
```
|
804
804
|
|
805
|
-
####Stones:####
|
806
|
-
`
|
805
|
+
####Stones in Ounces:####
|
806
|
+
`stone_in_ounces` and `stone_in_ounces` returns the amount of ounces in n stones.
|
807
807
|
|
808
808
|
```ruby
|
809
|
-
3.
|
809
|
+
3.stones_in_ounces #=> 672
|
810
810
|
```
|
811
811
|
|
812
812
|
####Subtract:####
|
@@ -816,15 +816,15 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
816
816
|
4.subtract(2) #=> 2
|
817
817
|
```
|
818
818
|
|
819
|
-
####Terabytes:####
|
820
|
-
`
|
819
|
+
####Terabytes in Bytes:####
|
820
|
+
`terabyte_in_bytes` and `terabytes_in_bytes` returns the amount of bytes in n terabytes.
|
821
821
|
|
822
822
|
```ruby
|
823
|
-
3.
|
823
|
+
3.terabytes_in_bytes #=> 3298534883328
|
824
824
|
```
|
825
825
|
|
826
826
|
####To Byte:####
|
827
|
-
`
|
827
|
+
`to_byte_in_bytes` converts a byte size from one unit to another unit.
|
828
828
|
|
829
829
|
```ruby
|
830
830
|
1.to_byte(:byte, :byte) #=> 1 #B
|
@@ -910,32 +910,32 @@ h.slice!(:a, :b) #=> { c: 3, d: 4 }
|
|
910
910
|
1825.to_time(:days, :years) #=> 4.996577686516085 #YR
|
911
911
|
```
|
912
912
|
|
913
|
-
####Tons:####
|
914
|
-
`
|
913
|
+
####Tons in Ounces:####
|
914
|
+
`ton_in_ounces` and `ton_in_ounces` returns the amount of ounces in n tons.
|
915
915
|
|
916
916
|
```ruby
|
917
|
-
3.
|
917
|
+
3.tons_in_ounces #=> 96000
|
918
918
|
```
|
919
919
|
|
920
|
-
####Weeks:####
|
921
|
-
`
|
920
|
+
####Weeks in Seconds:####
|
921
|
+
`week_in_seconds` and `weeks_in_seconds` returns the amount of seconds in n weeks.
|
922
922
|
|
923
923
|
```ruby
|
924
|
-
3.
|
924
|
+
3.weeks_in_seconds #=> 1814400
|
925
925
|
```
|
926
926
|
|
927
|
-
####Yards:####
|
928
|
-
`
|
927
|
+
####Yards in Inches:####
|
928
|
+
`yard_in_inches` and `yards_in_inches` returns the amount of inches in n yards.
|
929
929
|
|
930
930
|
```ruby
|
931
|
-
3.
|
931
|
+
3.yards_in_inches #=> 108
|
932
932
|
```
|
933
933
|
|
934
|
-
####Years:####
|
935
|
-
`
|
934
|
+
####Years in Seconds:####
|
935
|
+
`year_in_seconds` and `years_in_seconds` returns the amount of seconds in n years.
|
936
936
|
|
937
937
|
```ruby
|
938
|
-
3.
|
938
|
+
3.years_in_seconds #=> 94672800.0
|
939
939
|
```
|
940
940
|
|
941
941
|
### Object
|
@@ -40,192 +40,192 @@ class Numeric
|
|
40
40
|
end
|
41
41
|
|
42
42
|
unless defined?(Rails)
|
43
|
-
def
|
43
|
+
def bytes_in_bytes
|
44
44
|
self
|
45
45
|
end
|
46
46
|
|
47
|
-
alias_method :
|
47
|
+
alias_method :byte_in_bytes, :bytes_in_bytes
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def centigrams_in_grams
|
51
51
|
self * CENTI
|
52
52
|
end
|
53
53
|
|
54
|
-
alias_method :
|
54
|
+
alias_method :centigram_in_grams, :centigrams_in_grams
|
55
55
|
|
56
|
-
def
|
56
|
+
def centimeters_in_meters
|
57
57
|
self * CENTI
|
58
58
|
end
|
59
59
|
|
60
|
-
alias_method :
|
60
|
+
alias_method :centimeter_in_meters, :centimeters_in_meters
|
61
61
|
|
62
|
-
def
|
62
|
+
def centuries_in_seconds
|
63
63
|
self * CENTURY
|
64
64
|
end
|
65
65
|
|
66
|
-
alias_method :
|
66
|
+
alias_method :century_in_seconds, :centuries_in_seconds
|
67
67
|
|
68
|
-
def
|
68
|
+
def days_in_seconds
|
69
69
|
self * DAY
|
70
70
|
end
|
71
71
|
|
72
|
-
alias_method :
|
72
|
+
alias_method :day_in_seconds, :days_in_seconds
|
73
73
|
|
74
|
-
def
|
74
|
+
def decades_in_seconds
|
75
75
|
self * DECADE
|
76
76
|
end
|
77
77
|
|
78
|
-
alias_method :
|
78
|
+
alias_method :decade_in_seconds, :decades_in_seconds
|
79
79
|
|
80
|
-
def
|
80
|
+
def decagrams_in_grams
|
81
81
|
self * DECA
|
82
82
|
end
|
83
83
|
|
84
|
-
alias_method :
|
84
|
+
alias_method :decagram_in_grams, :decagrams_in_grams
|
85
85
|
|
86
|
-
def
|
86
|
+
def decameters_in_meters
|
87
87
|
self * DECA
|
88
88
|
end
|
89
89
|
|
90
|
-
alias_method :
|
90
|
+
alias_method :decameter_in_meters, :decameters_in_meters
|
91
91
|
|
92
|
-
def
|
92
|
+
def decigrams_in_grams
|
93
93
|
self * DECI
|
94
94
|
end
|
95
95
|
|
96
|
-
alias_method :
|
96
|
+
alias_method :decigram_in_grams, :decigrams_in_grams
|
97
97
|
|
98
|
-
def
|
98
|
+
def decimeters_in_meters
|
99
99
|
self * DECI
|
100
100
|
end
|
101
101
|
|
102
|
-
alias_method :
|
102
|
+
alias_method :decimeter_in_meters, :decimeters_in_meters
|
103
103
|
|
104
104
|
def divide(n)
|
105
105
|
self / n
|
106
106
|
end
|
107
107
|
|
108
108
|
unless defined?(Rails)
|
109
|
-
def
|
109
|
+
def exabytes_in_bytes
|
110
110
|
self * EXABYTE
|
111
111
|
end
|
112
112
|
|
113
|
-
alias_method :
|
113
|
+
alias_method :exabyte_in_bytes, :exabytes_in_bytes
|
114
114
|
end
|
115
115
|
|
116
|
-
def
|
116
|
+
def feet_in_inches
|
117
117
|
self * FEET
|
118
118
|
end
|
119
119
|
|
120
|
-
alias_method :
|
120
|
+
alias_method :foot_in_inches, :feet_in_inches
|
121
121
|
|
122
122
|
unless defined?(Rails)
|
123
|
-
def
|
123
|
+
def gigabytes_in_bytes
|
124
124
|
self * GIGABYTE
|
125
125
|
end
|
126
126
|
|
127
|
-
alias_method :
|
127
|
+
alias_method :gigabyte_in_bytes, :gigabytes_in_bytes
|
128
128
|
end
|
129
129
|
|
130
|
-
def
|
130
|
+
def grams_in_grams
|
131
131
|
self
|
132
132
|
end
|
133
133
|
|
134
|
-
alias_method :
|
134
|
+
alias_method :gram_in_grams, :grams_in_grams
|
135
135
|
|
136
|
-
def
|
136
|
+
def hectograms_in_grams
|
137
137
|
self * HECTO
|
138
138
|
end
|
139
139
|
|
140
|
-
alias_method :
|
140
|
+
alias_method :hectogram_in_grams, :hectograms_in_grams
|
141
141
|
|
142
|
-
def
|
142
|
+
def hectometers_in_meters
|
143
143
|
self * HECTO
|
144
144
|
end
|
145
145
|
|
146
|
-
alias_method :
|
146
|
+
alias_method :hectometer_in_meters, :hectometers_in_meters
|
147
147
|
|
148
|
-
def
|
148
|
+
def hours_in_seconds
|
149
149
|
self * HOUR
|
150
150
|
end
|
151
151
|
|
152
|
-
alias_method :
|
152
|
+
alias_method :hour_in_seconds, :hours_in_seconds
|
153
153
|
|
154
|
-
def
|
154
|
+
def inches_in_inches
|
155
155
|
self
|
156
156
|
end
|
157
157
|
|
158
|
-
alias_method :
|
158
|
+
alias_method :inch_in_inches, :inches_in_inches
|
159
159
|
|
160
160
|
unless defined?(Rails)
|
161
|
-
def
|
161
|
+
def kilobytes_in_bytes
|
162
162
|
self * KILOBYTE
|
163
163
|
end
|
164
164
|
|
165
|
-
alias_method :
|
165
|
+
alias_method :kilobyte_in_bytes, :kilobytes_in_bytes
|
166
166
|
end
|
167
167
|
|
168
|
-
def
|
168
|
+
def kilometers_in_meters
|
169
169
|
self * KILO
|
170
170
|
end
|
171
171
|
|
172
|
-
alias_method :
|
172
|
+
alias_method :kilometer_in_meters, :kilometers_in_meters
|
173
173
|
|
174
|
-
def
|
174
|
+
def kilograms_in_grams
|
175
175
|
self * KILO
|
176
176
|
end
|
177
177
|
|
178
|
-
alias_method :
|
178
|
+
alias_method :kilogram_in_grams, :kilograms_in_grams
|
179
179
|
|
180
|
-
def
|
180
|
+
def metric_tons_in_grams
|
181
181
|
self * METRIC_TON
|
182
182
|
end
|
183
183
|
|
184
|
-
alias_method :
|
184
|
+
alias_method :metric_ton_in_grams, :metric_tons_in_grams
|
185
185
|
|
186
186
|
unless defined?(Rails)
|
187
|
-
def
|
187
|
+
def megabytes_in_bytes
|
188
188
|
self * MEGABYTE
|
189
189
|
end
|
190
190
|
|
191
|
-
alias_method :
|
191
|
+
alias_method :megabyte_in_bytes, :megabytes_in_bytes
|
192
192
|
end
|
193
193
|
|
194
|
-
def
|
194
|
+
def meters_in_meters
|
195
195
|
self
|
196
196
|
end
|
197
197
|
|
198
|
-
alias_method :
|
198
|
+
alias_method :meter_in_meters, :meters_in_meters
|
199
199
|
|
200
|
-
def
|
200
|
+
def miles_in_inches
|
201
201
|
self * MILE
|
202
202
|
end
|
203
203
|
|
204
|
-
alias_method :
|
204
|
+
alias_method :mile_in_inches, :miles_in_inches
|
205
205
|
|
206
|
-
def
|
206
|
+
def millenniums_in_seconds
|
207
207
|
self * MILLENNIUM
|
208
208
|
end
|
209
209
|
|
210
|
-
alias_method :
|
210
|
+
alias_method :millennium_in_seconds, :millenniums_in_seconds
|
211
211
|
|
212
|
-
def
|
212
|
+
def milligrams_in_grams
|
213
213
|
self * MILLI
|
214
214
|
end
|
215
215
|
|
216
|
-
alias_method :
|
216
|
+
alias_method :milligram_in_grams, :milligrams_in_grams
|
217
217
|
|
218
|
-
def
|
218
|
+
def millimeters_in_meters
|
219
219
|
self * MILLI
|
220
220
|
end
|
221
221
|
|
222
|
-
alias_method :
|
222
|
+
alias_method :millimeter_in_meters, :millimeters_in_meters
|
223
223
|
|
224
|
-
def
|
224
|
+
def minutes_in_seconds
|
225
225
|
self * MINUTE
|
226
226
|
end
|
227
227
|
|
228
|
-
alias_method :
|
228
|
+
alias_method :minute_in_seconds, :minutes_in_seconds
|
229
229
|
|
230
230
|
def multiply(n)
|
231
231
|
self * n
|
@@ -237,11 +237,11 @@ class Numeric
|
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
|
-
def
|
240
|
+
def nautical_miles_in_inches
|
241
241
|
self * NAUTICAL_MILE
|
242
242
|
end
|
243
243
|
|
244
|
-
alias_method :
|
244
|
+
alias_method :nautical_mile_in_inches, :nautical_miles_in_inches
|
245
245
|
|
246
246
|
def negative?
|
247
247
|
self < 0
|
@@ -270,11 +270,11 @@ class Numeric
|
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
|
-
def
|
273
|
+
def ounces_in_ounces
|
274
274
|
self
|
275
275
|
end
|
276
276
|
|
277
|
-
alias_method :
|
277
|
+
alias_method :ounce_in_ounces, :ounces_in_ounces
|
278
278
|
|
279
279
|
def pad(options={})
|
280
280
|
pad_number = options.fetch(:pad_number, 0)
|
@@ -297,22 +297,22 @@ class Numeric
|
|
297
297
|
end
|
298
298
|
|
299
299
|
unless defined?(Rails)
|
300
|
-
def
|
300
|
+
def petabytes_in_bytes
|
301
301
|
self * PETABYTE
|
302
302
|
end
|
303
303
|
|
304
|
-
alias_method :
|
304
|
+
alias_method :petabyte_in_bytes, :petabytes_in_bytes
|
305
305
|
end
|
306
306
|
|
307
307
|
def positive?
|
308
308
|
self > 0
|
309
309
|
end
|
310
310
|
|
311
|
-
def
|
311
|
+
def pounds_in_ounces
|
312
312
|
self * POUND
|
313
313
|
end
|
314
314
|
|
315
|
-
alias_method :
|
315
|
+
alias_method :pound_in_ounces, :pounds_in_ounces
|
316
316
|
|
317
317
|
def power(n)
|
318
318
|
self ** n
|
@@ -322,28 +322,28 @@ class Numeric
|
|
322
322
|
self ** (1.0 / n)
|
323
323
|
end
|
324
324
|
|
325
|
-
def
|
325
|
+
def seconds_in_seconds
|
326
326
|
self
|
327
327
|
end
|
328
328
|
|
329
|
-
alias_method :
|
329
|
+
alias_method :second_in_seconds, :seconds_in_seconds
|
330
330
|
|
331
|
-
def
|
331
|
+
def stones_in_ounces
|
332
332
|
self * STONE
|
333
333
|
end
|
334
334
|
|
335
|
-
alias_method :
|
335
|
+
alias_method :stone_in_ounces, :stones_in_ounces
|
336
336
|
|
337
337
|
def subtract(n)
|
338
338
|
self - n
|
339
339
|
end
|
340
340
|
|
341
341
|
unless defined?(Rails)
|
342
|
-
def
|
342
|
+
def terabytes_in_bytes
|
343
343
|
self * TERABYTE
|
344
344
|
end
|
345
345
|
|
346
|
-
alias_method :
|
346
|
+
alias_method :terabyte_in_bytes, :terabytes_in_bytes
|
347
347
|
end
|
348
348
|
|
349
349
|
def to_byte(from, to)
|
@@ -362,7 +362,7 @@ class Numeric
|
|
362
362
|
"Unknown key(s): form: #{from.inspect} and to: #{to.inspect}, Valid keys are: #{valid_keys.map(&:inspect).join(', ')}"
|
363
363
|
end
|
364
364
|
|
365
|
-
to_f * 1.send(from) / 1.send(to)
|
365
|
+
to_f * 1.send("#{from}_in_bytes") / 1.send("#{to}_in_bytes")
|
366
366
|
end
|
367
367
|
|
368
368
|
def to_currency(options={})
|
@@ -397,15 +397,15 @@ class Numeric
|
|
397
397
|
self
|
398
398
|
when :meter, :meters, :millimeter, :millimeters, :centimeter, :centimeters, :decimeter, :decimeters, :decameter, :decameters, :hectometer, :hectometers, :kilometer, :kilometers
|
399
399
|
if valid_keys.first(14).include?(from)
|
400
|
-
to_f * 1.send(from) / 1.send(to)
|
400
|
+
to_f * 1.send("#{from}_in_meters") / 1.send("#{to}_in_meters")
|
401
401
|
else
|
402
|
-
to_f * ((1.send(from) * 0.0254) / 1.send(to))
|
402
|
+
to_f * ((1.send("#{from}_in_inches") * 0.0254) / 1.send("#{to}_in_meters"))
|
403
403
|
end
|
404
404
|
when :inch, :inches, :foot, :feet, :yard, :yards, :mile, :miles, :nautical_mile, :nautical_miles
|
405
405
|
if valid_keys.first(14).include?(from)
|
406
|
-
to_f * ((1.send(from) * 39.3701) / 1.send(to))
|
406
|
+
to_f * ((1.send("#{from}_in_meters") * 39.3701) / 1.send("#{to}_in_inches"))
|
407
407
|
else
|
408
|
-
to_f * 1.send(from) / 1.send(to)
|
408
|
+
to_f * 1.send("#{from}_in_inches") / 1.send("#{to}_in_inches")
|
409
409
|
end
|
410
410
|
end
|
411
411
|
end
|
@@ -436,15 +436,15 @@ class Numeric
|
|
436
436
|
self
|
437
437
|
when :gram, :grams, :milligram, :milligrams, :centigram, :centigrams, :decigram, :decigrams, :decagram, :decagrams, :hectogram, :hectograms, :kilogram, :kilograms, :metric_ton, :metric_tons
|
438
438
|
if valid_keys.first(16).include?(from)
|
439
|
-
to_f * 1.send(from) / 1.send(to)
|
439
|
+
to_f * 1.send("#{from}_in_grams") / 1.send("#{to}_in_grams")
|
440
440
|
else
|
441
|
-
to_f * ((1.send(from) * 28.3495) / 1.send(to))
|
441
|
+
to_f * ((1.send("#{from}_in_ounces") * 28.3495) / 1.send("#{to}_in_grams"))
|
442
442
|
end
|
443
443
|
when :ounce, :ounces, :pound, :pounds, :stone, :stones, :ton, :tons
|
444
444
|
if valid_keys.first(16).include?(from)
|
445
|
-
to_f * ((1.send(from) * 0.035274) / 1.send(to))
|
445
|
+
to_f * ((1.send("#{from}_in_grams") * 0.035274) / 1.send("#{to}_in_ounces"))
|
446
446
|
else
|
447
|
-
to_f * 1.send(from) / 1.send(to)
|
447
|
+
to_f * 1.send("#{from}_in_ounces") / 1.send("#{to}_in_ounces")
|
448
448
|
end
|
449
449
|
end
|
450
450
|
end
|
@@ -507,31 +507,31 @@ class Numeric
|
|
507
507
|
"Unknown key(s): form: #{from.inspect} and to: #{to.inspect}, Valid keys are: #{valid_keys.map(&:inspect).join(', ')}"
|
508
508
|
end
|
509
509
|
|
510
|
-
to_f * 1.send(from) / 1.send(to)
|
510
|
+
to_f * 1.send("#{from}_in_seconds") / 1.send("#{to}_in_seconds")
|
511
511
|
end
|
512
512
|
|
513
|
-
def
|
513
|
+
def tons_in_ounces
|
514
514
|
self * TON
|
515
515
|
end
|
516
516
|
|
517
|
-
alias_method :
|
517
|
+
alias_method :ton_in_ounces, :tons_in_ounces
|
518
518
|
|
519
|
-
def
|
519
|
+
def weeks_in_seconds
|
520
520
|
self * WEEK
|
521
521
|
end
|
522
522
|
|
523
|
-
alias_method :
|
523
|
+
alias_method :week_in_seconds, :weeks_in_seconds
|
524
524
|
|
525
|
-
def
|
525
|
+
def yards_in_inches
|
526
526
|
self * YARD
|
527
527
|
end
|
528
528
|
|
529
|
-
alias_method :
|
529
|
+
alias_method :yard_in_inches, :yards_in_inches
|
530
530
|
|
531
|
-
def
|
531
|
+
def years_in_seconds
|
532
532
|
self * YEAR
|
533
533
|
end
|
534
534
|
|
535
|
-
alias_method :
|
535
|
+
alias_method :year_in_seconds, :years_in_seconds
|
536
536
|
|
537
537
|
end
|
data/spec/lib/numeric_spec.rb
CHANGED
@@ -8,73 +8,73 @@ describe Numeric do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe "#
|
11
|
+
describe "#byte_in_bytes" do
|
12
12
|
it "to be 3" do
|
13
|
-
expect(3.
|
14
|
-
expect(3.
|
13
|
+
expect(3.byte_in_bytes).to eq(3)
|
14
|
+
expect(3.bytes_in_bytes).to eq(3)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "#
|
18
|
+
describe "#centigram_in_grams" do
|
19
19
|
it "to be 0.03" do
|
20
|
-
expect(3.
|
21
|
-
expect(3.
|
20
|
+
expect(3.centigram_in_grams).to eq(0.03)
|
21
|
+
expect(3.centigrams_in_grams).to eq(0.03)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe "#
|
25
|
+
describe "#centimeter_in_meters" do
|
26
26
|
it "to be 0.03" do
|
27
|
-
expect(3.
|
28
|
-
expect(3.
|
27
|
+
expect(3.centimeter_in_meters).to eq(0.03)
|
28
|
+
expect(3.centimeters_in_meters).to eq(0.03)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe "#
|
32
|
+
describe "#century_in_second" do
|
33
33
|
it "to be 259200" do
|
34
|
-
expect(3.
|
35
|
-
expect(3.
|
34
|
+
expect(3.century_in_seconds).to eq(9467280000.0)
|
35
|
+
expect(3.centuries_in_seconds).to eq(9467280000.0)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe "#
|
39
|
+
describe "#decade_in_second" do
|
40
40
|
it "to be 259200" do
|
41
|
-
expect(3.
|
42
|
-
expect(3.
|
41
|
+
expect(3.decade_in_seconds).to eq(946728000.0)
|
42
|
+
expect(3.decades_in_seconds).to eq(946728000.0)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "#
|
46
|
+
describe "#decagram_in_grams" do
|
47
47
|
it "to be 30" do
|
48
|
-
expect(3.
|
49
|
-
expect(3.
|
48
|
+
expect(3.decagram_in_grams).to eq(30)
|
49
|
+
expect(3.decagrams_in_grams).to eq(30)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe "#
|
53
|
+
describe "#decameter_in_meters" do
|
54
54
|
it "to be 30" do
|
55
|
-
expect(3.
|
56
|
-
expect(3.
|
55
|
+
expect(3.decameter_in_meters).to eq(30)
|
56
|
+
expect(3.decameters_in_meters).to eq(30)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe "#
|
60
|
+
describe "#decigrams_in_grams" do
|
61
61
|
it "to be 0.3" do
|
62
|
-
expect(3.
|
63
|
-
expect(3.
|
62
|
+
expect(3.decigram_in_grams).to eq(0.30000000000000004)
|
63
|
+
expect(3.decigrams_in_grams).to eq(0.30000000000000004)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
describe "#
|
67
|
+
describe "#decimeter_in_meters" do
|
68
68
|
it "to be 0.3" do
|
69
|
-
expect(3.
|
70
|
-
expect(3.
|
69
|
+
expect(3.decimeter_in_meters).to eq(0.30000000000000004)
|
70
|
+
expect(3.decimeters_in_meters).to eq(0.30000000000000004)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
describe "#
|
74
|
+
describe "#day_in_second" do
|
75
75
|
it "to be 259200" do
|
76
|
-
expect(3.
|
77
|
-
expect(3.
|
76
|
+
expect(3.day_in_seconds).to eq(259200)
|
77
|
+
expect(3.days_in_seconds).to eq(259200)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -84,136 +84,136 @@ describe Numeric do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
describe "#
|
87
|
+
describe "#exabyte_in_bytes" do
|
88
88
|
it "to be 3458764513820540928" do
|
89
|
-
expect(3.
|
90
|
-
expect(3.
|
89
|
+
expect(3.exabyte_in_bytes).to eq(3458764513820540928)
|
90
|
+
expect(3.exabytes_in_bytes).to eq(3458764513820540928)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
describe "#
|
94
|
+
describe "#feet_in_inches" do
|
95
95
|
it "to be 36" do
|
96
|
-
expect(3.
|
97
|
-
expect(3.
|
96
|
+
expect(3.foot_in_inches).to eq(36)
|
97
|
+
expect(3.feet_in_inches).to eq(36)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
describe "#
|
101
|
+
describe "#gigabyte_in_bytes" do
|
102
102
|
it "to be 3221225472" do
|
103
|
-
expect(3.
|
104
|
-
expect(3.
|
103
|
+
expect(3.gigabyte_in_bytes).to eq(3221225472)
|
104
|
+
expect(3.gigabytes_in_bytes).to eq(3221225472)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
describe "#
|
108
|
+
describe "#gram_in_grams" do
|
109
109
|
it "to be 300" do
|
110
|
-
expect(3.
|
111
|
-
expect(3.
|
110
|
+
expect(3.gram_in_grams).to eq(3)
|
111
|
+
expect(3.grams_in_grams).to eq(3)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
describe "#
|
115
|
+
describe "#hectogram_in_grams" do
|
116
116
|
it "to be 300" do
|
117
|
-
expect(3.
|
118
|
-
expect(3.
|
117
|
+
expect(3.hectogram_in_grams).to eq(300)
|
118
|
+
expect(3.hectograms_in_grams).to eq(300)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe "#
|
122
|
+
describe "#hectometer_in_meters" do
|
123
123
|
it "to be 300" do
|
124
|
-
expect(3.
|
125
|
-
expect(3.
|
124
|
+
expect(3.hectometer_in_meters).to eq(300)
|
125
|
+
expect(3.hectometers_in_meters).to eq(300)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
describe "#
|
129
|
+
describe "#hour_in_second" do
|
130
130
|
it "to be 10800" do
|
131
|
-
expect(3.
|
132
|
-
expect(3.
|
131
|
+
expect(3.hour_in_seconds).to eq(10800)
|
132
|
+
expect(3.hours_in_seconds).to eq(10800)
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
describe "#
|
136
|
+
describe "#inch_in_inches" do
|
137
137
|
it "to be 3" do
|
138
|
-
expect(3.
|
139
|
-
expect(3.
|
138
|
+
expect(3.inch_in_inches).to eq(3)
|
139
|
+
expect(3.inches_in_inches).to eq(3)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
describe "#
|
143
|
+
describe "#kilobytes_in_bytes" do
|
144
144
|
it "to be 3072" do
|
145
|
-
expect(3.
|
146
|
-
expect(3.
|
145
|
+
expect(3.kilobyte_in_bytes).to eq(3072)
|
146
|
+
expect(3.kilobytes_in_bytes).to eq(3072)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
describe "#
|
150
|
+
describe "#kilograms_in_grams" do
|
151
151
|
it "to be 3000" do
|
152
|
-
expect(3.
|
153
|
-
expect(3.
|
152
|
+
expect(3.kilogram_in_grams).to eq(3000)
|
153
|
+
expect(3.kilograms_in_grams).to eq(3000)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
describe "#
|
157
|
+
describe "#kilometer_in_meters" do
|
158
158
|
it "to be 3000" do
|
159
|
-
expect(3.
|
160
|
-
expect(3.
|
159
|
+
expect(3.kilometer_in_meters).to eq(3000)
|
160
|
+
expect(3.kilometers_in_meters).to eq(3000)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
describe "#
|
164
|
+
describe "#metric_ton_in_grams" do
|
165
165
|
it "to be 3000000" do
|
166
|
-
expect(3.
|
167
|
-
expect(3.
|
166
|
+
expect(3.metric_ton_in_grams).to eq(3000000)
|
167
|
+
expect(3.metric_tons_in_grams).to eq(3000000)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
describe "#
|
171
|
+
describe "#megabyte_in_bytes" do
|
172
172
|
it "to be 3145728" do
|
173
|
-
expect(3.
|
174
|
-
expect(3.
|
173
|
+
expect(3.megabyte_in_bytes).to eq(3145728)
|
174
|
+
expect(3.megabytes_in_bytes).to eq(3145728)
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
describe "#
|
178
|
+
describe "#meter_in_meters" do
|
179
179
|
it "to be 3" do
|
180
|
-
expect(3.
|
181
|
-
expect(3.
|
180
|
+
expect(3.meter_in_meters).to eq(3)
|
181
|
+
expect(3.meters_in_meters).to eq(3)
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
describe "#
|
185
|
+
describe "#mile_in_inches" do
|
186
186
|
it "to be 36" do
|
187
|
-
expect(3.
|
188
|
-
expect(3.
|
187
|
+
expect(3.mile_in_inches).to eq(190080)
|
188
|
+
expect(3.miles_in_inches).to eq(190080)
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
describe "#
|
192
|
+
describe "#millennium_in_second" do
|
193
193
|
it "to be 94672800000.0" do
|
194
|
-
expect(3.
|
195
|
-
expect(3.
|
194
|
+
expect(3.millennium_in_seconds).to eq(94672800000.0)
|
195
|
+
expect(3.millenniums_in_seconds).to eq(94672800000.0)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
describe "#
|
199
|
+
describe "#milligrams_in_grams" do
|
200
200
|
it "to be 0.003" do
|
201
|
-
expect(3.
|
202
|
-
expect(3.
|
201
|
+
expect(3.milligram_in_grams).to eq(0.003)
|
202
|
+
expect(3.milligrams_in_grams).to eq(0.003)
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
|
-
describe "#
|
206
|
+
describe "#millimeter_in_meters" do
|
207
207
|
it "to be 0.003" do
|
208
|
-
expect(3.
|
209
|
-
expect(3.
|
208
|
+
expect(3.millimeter_in_meters).to eq(0.003)
|
209
|
+
expect(3.millimeters_in_meters).to eq(0.003)
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
describe "#
|
213
|
+
describe "#minute_in_second" do
|
214
214
|
it "to be 180" do
|
215
|
-
expect(3.
|
216
|
-
expect(3.
|
215
|
+
expect(3.minute_in_seconds).to eq(180)
|
216
|
+
expect(3.minutes_in_seconds).to eq(180)
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
@@ -234,10 +234,10 @@ describe Numeric do
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
describe "#
|
237
|
+
describe "#nautical_mile_in_inches" do
|
238
238
|
it "to be 218740.26239999998" do
|
239
|
-
expect(3.
|
240
|
-
expect(3.
|
239
|
+
expect(3.nautical_mile_in_inches).to eq(218740.26239999998)
|
240
|
+
expect(3.nautical_miles_in_inches).to eq(218740.26239999998)
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
@@ -287,10 +287,10 @@ describe Numeric do
|
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
|
-
describe "#
|
290
|
+
describe "#ounce_in_ounces" do
|
291
291
|
it "to be 3" do
|
292
|
-
expect(3.
|
293
|
-
expect(3.
|
292
|
+
expect(3.ounce_in_ounces).to eq(3)
|
293
|
+
expect(3.ounces_in_ounces).to eq(3)
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
@@ -334,10 +334,10 @@ describe Numeric do
|
|
334
334
|
end
|
335
335
|
end
|
336
336
|
|
337
|
-
describe "#
|
337
|
+
describe "#petabyte_in_bytes" do
|
338
338
|
it "to be 3377699720527872" do
|
339
|
-
expect(3.
|
340
|
-
expect(3.
|
339
|
+
expect(3.petabyte_in_bytes).to eq(3377699720527872)
|
340
|
+
expect(3.petabytes_in_bytes).to eq(3377699720527872)
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
@@ -351,10 +351,10 @@ describe Numeric do
|
|
351
351
|
end
|
352
352
|
end
|
353
353
|
|
354
|
-
describe "#
|
354
|
+
describe "#pound_in_ounces" do
|
355
355
|
it "to be 48" do
|
356
|
-
expect(3.
|
357
|
-
expect(3.
|
356
|
+
expect(3.pound_in_ounces).to eq(48)
|
357
|
+
expect(3.pounds_in_ounces).to eq(48)
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
@@ -370,17 +370,17 @@ describe Numeric do
|
|
370
370
|
end
|
371
371
|
end
|
372
372
|
|
373
|
-
describe "#
|
373
|
+
describe "#second_in_seconds" do
|
374
374
|
it "to be 3" do
|
375
|
-
expect(3.
|
376
|
-
expect(3.
|
375
|
+
expect(3.second_in_seconds).to eq(3)
|
376
|
+
expect(3.seconds_in_seconds).to eq(3)
|
377
377
|
end
|
378
378
|
end
|
379
379
|
|
380
|
-
describe "#
|
380
|
+
describe "#stone_in_ounces" do
|
381
381
|
it "to be 672" do
|
382
|
-
expect(3.
|
383
|
-
expect(3.
|
382
|
+
expect(3.stone_in_ounces).to eq(672)
|
383
|
+
expect(3.stones_in_ounces).to eq(672)
|
384
384
|
end
|
385
385
|
end
|
386
386
|
|
@@ -390,10 +390,10 @@ describe Numeric do
|
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
393
|
-
describe "#
|
393
|
+
describe "#terabyte_in_bytes" do
|
394
394
|
it "to be 3298534883328" do
|
395
|
-
expect(3.
|
396
|
-
expect(3.
|
395
|
+
expect(3.terabyte_in_bytes).to eq(3298534883328)
|
396
|
+
expect(3.terabytes_in_bytes).to eq(3298534883328)
|
397
397
|
end
|
398
398
|
end
|
399
399
|
|
@@ -625,31 +625,31 @@ describe Numeric do
|
|
625
625
|
end
|
626
626
|
end
|
627
627
|
|
628
|
-
describe "#
|
628
|
+
describe "#ton_in_ounces" do
|
629
629
|
it "to be 96000" do
|
630
|
-
expect(3.
|
631
|
-
expect(3.
|
630
|
+
expect(3.ton_in_ounces).to eq(96000)
|
631
|
+
expect(3.tons_in_ounces).to eq(96000)
|
632
632
|
end
|
633
633
|
end
|
634
634
|
|
635
|
-
describe "#
|
635
|
+
describe "#week_in_seconds" do
|
636
636
|
it "to be 1814400" do
|
637
|
-
expect(3.
|
638
|
-
expect(3.
|
637
|
+
expect(3.week_in_seconds).to eq(1814400)
|
638
|
+
expect(3.weeks_in_seconds).to eq(1814400)
|
639
639
|
end
|
640
640
|
end
|
641
641
|
|
642
|
-
describe "#
|
642
|
+
describe "#yard_in_inches" do
|
643
643
|
it "to be 36" do
|
644
|
-
expect(3.
|
645
|
-
expect(3.
|
644
|
+
expect(3.yard_in_inches).to eq(108)
|
645
|
+
expect(3.yards_in_inches).to eq(108)
|
646
646
|
end
|
647
647
|
end
|
648
648
|
|
649
|
-
describe "#
|
649
|
+
describe "#year_in_seconds" do
|
650
650
|
it "to be 94672800.0" do
|
651
|
-
expect(3.
|
652
|
-
expect(3.
|
651
|
+
expect(3.year_in_seconds).to eq(94672800.0)
|
652
|
+
expect(3.years_in_seconds).to eq(94672800.0)
|
653
653
|
end
|
654
654
|
end
|
655
655
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|