sugarcube 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sugarcube/symbol.rb +42 -42
- data/lib/sugarcube/symbol/symbol_uicolor.rb +2 -2
- data/lib/sugarcube/to_s/uicolor.rb +2 -2
- data/lib/sugarcube/uicolor.rb +3 -1
- data/lib/sugarcube/version.rb +1 -1
- metadata +2 -2
    
        data/lib/sugarcube/symbol.rb
    CHANGED
    
    | @@ -498,187 +498,187 @@ class Symbol | |
| 498 498 | 
             
              }
         | 
| 499 499 |  | 
| 500 500 | 
             
              private
         | 
| 501 | 
            -
              def  | 
| 501 | 
            +
              def sugarcube_look_in(here)
         | 
| 502 502 | 
             
                return here[self] if here.has_key? self
         | 
| 503 503 | 
             
                raise SugarNotFoundException.new(self.inspect)
         | 
| 504 504 | 
             
              end
         | 
| 505 505 |  | 
| 506 506 | 
             
              public
         | 
| 507 507 | 
             
              def uidevice
         | 
| 508 | 
            -
                 | 
| 508 | 
            +
                sugarcube_look_in(Symbol.devices)
         | 
| 509 509 | 
             
              end
         | 
| 510 510 |  | 
| 511 511 | 
             
              def uideviceorientation
         | 
| 512 | 
            -
                 | 
| 512 | 
            +
                sugarcube_look_in(Symbol.device_orientations)
         | 
| 513 513 | 
             
              end
         | 
| 514 514 |  | 
| 515 515 | 
             
              def uiinterfaceorientation
         | 
| 516 | 
            -
                 | 
| 516 | 
            +
                sugarcube_look_in(Symbol.interface_orientations)
         | 
| 517 517 | 
             
              end
         | 
| 518 518 |  | 
| 519 519 | 
             
              def uiinterfacemask
         | 
| 520 | 
            -
                 | 
| 520 | 
            +
                sugarcube_look_in(Symbol.interface_masks)
         | 
| 521 521 | 
             
              end
         | 
| 522 522 |  | 
| 523 523 | 
             
              def uitextalignment
         | 
| 524 | 
            -
                 | 
| 524 | 
            +
                sugarcube_look_in(Symbol.textalignments)
         | 
| 525 525 | 
             
              end
         | 
| 526 526 | 
             
              alias uialignment uitextalignment
         | 
| 527 527 |  | 
| 528 528 |  | 
| 529 529 | 
             
              def uilinebreakmode
         | 
| 530 | 
            -
                 | 
| 530 | 
            +
                sugarcube_look_in(Symbol.linebreakmodes)
         | 
| 531 531 | 
             
              end
         | 
| 532 532 |  | 
| 533 533 | 
             
              def uibaselineadjustment
         | 
| 534 | 
            -
                 | 
| 534 | 
            +
                sugarcube_look_in(Symbol.baselineadjustments)
         | 
| 535 535 | 
             
              end
         | 
| 536 536 | 
             
              alias uibaseline uibaselineadjustment
         | 
| 537 537 |  | 
| 538 538 |  | 
| 539 539 | 
             
              def uiinterfaceorientation
         | 
| 540 | 
            -
                 | 
| 540 | 
            +
                sugarcube_look_in(Symbol.orientations)
         | 
| 541 541 | 
             
              end
         | 
| 542 542 | 
             
              alias uiorientation uiinterfaceorientation
         | 
| 543 543 |  | 
| 544 544 | 
             
              def uibuttontype
         | 
| 545 | 
            -
                 | 
| 545 | 
            +
                sugarcube_look_in(Symbol.buttontypes)
         | 
| 546 546 | 
             
              end
         | 
| 547 547 |  | 
| 548 548 | 
             
              def uibordertype
         | 
| 549 | 
            -
                 | 
| 549 | 
            +
                sugarcube_look_in(Symbol.border_types)
         | 
| 550 550 | 
             
              end
         | 
| 551 551 | 
             
              alias uiborderstyle uibordertype
         | 
| 552 552 |  | 
| 553 553 | 
             
              def uicontrolstate
         | 
| 554 | 
            -
                 | 
| 554 | 
            +
                sugarcube_look_in(Symbol.control_states)
         | 
| 555 555 | 
             
              end
         | 
| 556 556 | 
             
              alias uistate uicontrolstate
         | 
| 557 557 |  | 
| 558 558 |  | 
| 559 559 | 
             
              def uicontrolevent
         | 
| 560 | 
            -
                 | 
| 560 | 
            +
                sugarcube_look_in(Symbol.control_events)
         | 
| 561 561 | 
             
              end
         | 
| 562 562 |  | 
| 563 563 | 
             
              def uireturnkey
         | 
| 564 | 
            -
                 | 
| 564 | 
            +
                sugarcube_look_in(Symbol.returnkeys)
         | 
| 565 565 | 
             
              end
         | 
| 566 566 |  | 
| 567 567 | 
             
              def uiactivityindicatorstyle
         | 
| 568 | 
            -
                 | 
| 568 | 
            +
                sugarcube_look_in(Symbol.activityindicator_styles)
         | 
| 569 569 | 
             
              end
         | 
| 570 570 | 
             
              alias uiactivityindicatorviewstyle uiactivityindicatorstyle
         | 
| 571 571 |  | 
| 572 572 |  | 
| 573 573 | 
             
              def uisegmentedstyle
         | 
| 574 | 
            -
                 | 
| 574 | 
            +
                sugarcube_look_in(Symbol.segmented_styles)
         | 
| 575 575 | 
             
              end
         | 
| 576 576 | 
             
              alias uisegmentedcontrolstyle uisegmentedstyle
         | 
| 577 577 |  | 
| 578 578 |  | 
| 579 579 | 
             
              def uidatepickermode
         | 
| 580 | 
            -
                 | 
| 580 | 
            +
                sugarcube_look_in(Symbol.datepicker_modes)
         | 
| 581 581 | 
             
              end
         | 
| 582 582 |  | 
| 583 583 | 
             
              def uicontentmode
         | 
| 584 | 
            -
                 | 
| 584 | 
            +
                sugarcube_look_in(Symbol.content_modes)
         | 
| 585 585 | 
             
              end
         | 
| 586 586 | 
             
              alias uiviewcontentmode uicontentmode
         | 
| 587 587 |  | 
| 588 588 | 
             
              def uitablestyle
         | 
| 589 | 
            -
                 | 
| 589 | 
            +
                sugarcube_look_in(Symbol.tableview_styles)
         | 
| 590 590 | 
             
              end
         | 
| 591 591 | 
             
              alias uitableviewstyle uitablestyle
         | 
| 592 592 |  | 
| 593 593 | 
             
              def uitablerowanimation
         | 
| 594 | 
            -
                 | 
| 594 | 
            +
                sugarcube_look_in(Symbol.tableview_rowanimation)
         | 
| 595 595 | 
             
              end
         | 
| 596 596 | 
             
              alias uitableviewrowanimation uitablerowanimation
         | 
| 597 597 |  | 
| 598 598 | 
             
              def uitablecellstyle
         | 
| 599 | 
            -
                 | 
| 599 | 
            +
                sugarcube_look_in(Symbol.tableview_cellstyles)
         | 
| 600 600 | 
             
              end
         | 
| 601 601 | 
             
              alias uitableviewcellstyle uitablecellstyle
         | 
| 602 602 |  | 
| 603 603 | 
             
              def uitablecellaccessory
         | 
| 604 | 
            -
                 | 
| 604 | 
            +
                sugarcube_look_in(Symbol.tableview_cellaccessorytype)
         | 
| 605 605 | 
             
              end
         | 
| 606 606 | 
             
              alias uitableviewcellaccessorytype uitablecellaccessory
         | 
| 607 607 |  | 
| 608 608 | 
             
              def uitablecellselectionstyle
         | 
| 609 | 
            -
                 | 
| 609 | 
            +
                sugarcube_look_in(Symbol.tableview_cellselectionstyle)
         | 
| 610 610 | 
             
              end
         | 
| 611 611 | 
             
              alias uitableviewcellselectionstyle uitablecellselectionstyle
         | 
| 612 612 |  | 
| 613 613 | 
             
              def uitablecellseparatorstyle
         | 
| 614 | 
            -
                 | 
| 614 | 
            +
                sugarcube_look_in(Symbol.tableview_cellseparatorstyle)
         | 
| 615 615 | 
             
              end
         | 
| 616 616 |  | 
| 617 617 | 
             
              def uistatusbarstyle
         | 
| 618 | 
            -
                 | 
| 618 | 
            +
                sugarcube_look_in(Symbol.statusbar_styles)
         | 
| 619 619 | 
             
              end
         | 
| 620 620 |  | 
| 621 621 | 
             
              def uibarmetrics
         | 
| 622 | 
            -
                 | 
| 622 | 
            +
                sugarcube_look_in(Symbol.barmetrics)
         | 
| 623 623 | 
             
              end
         | 
| 624 624 |  | 
| 625 625 | 
             
              def uibarbuttonitem
         | 
| 626 | 
            -
                 | 
| 626 | 
            +
                sugarcube_look_in(Symbol.barbuttonitems)
         | 
| 627 627 | 
             
              end
         | 
| 628 628 |  | 
| 629 629 | 
             
              def uibarbuttonstyle
         | 
| 630 | 
            -
                 | 
| 630 | 
            +
                sugarcube_look_in(Symbol.barbuttonstyles)
         | 
| 631 631 | 
             
              end
         | 
| 632 632 |  | 
| 633 633 | 
             
              def uikeyboardtype
         | 
| 634 | 
            -
                 | 
| 634 | 
            +
                sugarcube_look_in(Symbol.keyboardtypes)
         | 
| 635 635 | 
             
              end
         | 
| 636 636 |  | 
| 637 637 | 
             
              def uiautoresizemask
         | 
| 638 | 
            -
                 | 
| 638 | 
            +
                sugarcube_look_in(Symbol.autoresizemasks)
         | 
| 639 639 | 
             
              end
         | 
| 640 640 | 
             
              alias uiviewautoresizing uiautoresizemask
         | 
| 641 641 | 
             
              alias uiautoresizingmask uiautoresizemask
         | 
| 642 642 | 
             
              alias uiautoresize uiautoresizemask
         | 
| 643 643 |  | 
| 644 644 | 
             
              def uiimagesource
         | 
| 645 | 
            -
                 | 
| 645 | 
            +
                sugarcube_look_in(Symbol.image_sourcetypes)
         | 
| 646 646 | 
             
              end
         | 
| 647 647 | 
             
              alias uiimagesourcetype uiimagesource
         | 
| 648 648 |  | 
| 649 649 | 
             
              def uiimagecapture
         | 
| 650 | 
            -
                 | 
| 650 | 
            +
                sugarcube_look_in(Symbol.image_capturemode)
         | 
| 651 651 | 
             
              end
         | 
| 652 652 | 
             
              alias uiimagecapturemode uiimagecapture
         | 
| 653 653 |  | 
| 654 654 | 
             
              def uiimagecamera
         | 
| 655 | 
            -
                 | 
| 655 | 
            +
                sugarcube_look_in(Symbol.image_cameradevice)
         | 
| 656 656 | 
             
              end
         | 
| 657 657 | 
             
              alias uiimagecameradevice uiimagecamera
         | 
| 658 658 | 
             
              alias uiimagedevice uiimagecamera
         | 
| 659 659 |  | 
| 660 660 | 
             
              def uiimagequality
         | 
| 661 | 
            -
                 | 
| 661 | 
            +
                sugarcube_look_in(Symbol.image_quality)
         | 
| 662 662 | 
             
              end
         | 
| 663 663 | 
             
              alias uiimagequalitytype uiimagequality
         | 
| 664 664 |  | 
| 665 665 | 
             
              def catimingfunction
         | 
| 666 | 
            -
                 | 
| 666 | 
            +
                sugarcube_look_in(Symbol.ca_timingfunctions)
         | 
| 667 667 | 
             
              end
         | 
| 668 668 | 
             
              alias catiming catimingfunction
         | 
| 669 669 |  | 
| 670 670 | 
             
              def cglinecap
         | 
| 671 | 
            -
                 | 
| 671 | 
            +
                sugarcube_look_in(Symbol.cg_linecapstyles)
         | 
| 672 672 | 
             
              end
         | 
| 673 673 | 
             
              alias cglinecapstyle cglinecap
         | 
| 674 674 |  | 
| 675 675 | 
             
              def cglinejoin
         | 
| 676 | 
            -
                 | 
| 676 | 
            +
                sugarcube_look_in(Symbol.cg_linejoinstyles)
         | 
| 677 677 | 
             
              end
         | 
| 678 678 | 
             
              alias cglinejoinstyle cglinejoin
         | 
| 679 679 |  | 
| 680 680 | 
             
              def uigesturerecognizerstate
         | 
| 681 | 
            -
                 | 
| 681 | 
            +
                sugarcube_look_in(Symbol.gesture_recognizer_states)
         | 
| 682 682 | 
             
              end
         | 
| 683 683 | 
             
              alias uigesturestate uigesturerecognizerstate
         | 
| 684 684 |  | 
| @@ -686,7 +686,7 @@ class Symbol | |
| 686 686 | 
             
                size ||= UIFont.systemFontSize
         | 
| 687 687 | 
             
                # system fonts
         | 
| 688 688 | 
             
                if Symbol.system_fonts.has_key? self
         | 
| 689 | 
            -
                  font =  | 
| 689 | 
            +
                  font = sugarcube_look_in(Symbol.system_fonts)
         | 
| 690 690 | 
             
                  if size.is_a?(Symbol)
         | 
| 691 691 | 
             
                    size = size.uifontsize
         | 
| 692 692 | 
             
                  end
         | 
| @@ -705,7 +705,7 @@ class Symbol | |
| 705 705 | 
             
              end
         | 
| 706 706 |  | 
| 707 707 | 
             
              def uifontsize
         | 
| 708 | 
            -
                size =  | 
| 708 | 
            +
                size = sugarcube_look_in(Symbol.font_sizes)
         | 
| 709 709 | 
             
                if size.is_a?(Symbol)
         | 
| 710 710 | 
             
                  return UIFont.send(size)
         | 
| 711 711 | 
             
                end
         | 
| @@ -713,12 +713,12 @@ class Symbol | |
| 713 713 | 
             
              end
         | 
| 714 714 |  | 
| 715 715 | 
             
              def nsdatestyle
         | 
| 716 | 
            -
                 | 
| 716 | 
            +
                sugarcube_look_in(Symbol.date_styles)
         | 
| 717 717 | 
             
              end
         | 
| 718 718 | 
             
              alias nsdateformatterstyle nsdatestyle
         | 
| 719 719 |  | 
| 720 720 | 
             
              def nsnumberstyle
         | 
| 721 | 
            -
                 | 
| 721 | 
            +
                sugarcube_look_in(Symbol.number_styles)
         | 
| 722 722 | 
             
              end
         | 
| 723 723 | 
             
              alias nsnumberformatterstyle nsnumberstyle
         | 
| 724 724 |  | 
| @@ -7,14 +7,14 @@ class Symbol | |
| 7 7 | 
             
              def uicolor(alpha=nil)
         | 
| 8 8 | 
             
                if Symbol.uicolors.has_key? self
         | 
| 9 9 | 
             
                  # iOS colors
         | 
| 10 | 
            -
                  color = UIColor.send( | 
| 10 | 
            +
                  color = UIColor.send(sugarcube_look_in(Symbol.uicolors))
         | 
| 11 11 |  | 
| 12 12 | 
             
                  if not alpha.nil?
         | 
| 13 13 | 
             
                    color = color.colorWithAlphaComponent(alpha.to_f)
         | 
| 14 14 | 
             
                  end
         | 
| 15 15 | 
             
                else
         | 
| 16 16 | 
             
                  # css colors
         | 
| 17 | 
            -
                  color =  | 
| 17 | 
            +
                  color = sugarcube_look_in(Symbol.css_colors).uicolor(alpha)
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                color
         | 
| @@ -18,10 +18,10 @@ class UIColor | |
| 18 18 | 
             
                alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
         | 
| 19 19 | 
             
                if system_name
         | 
| 20 20 | 
             
                  return "UIColor.#{system_name}#{alpha_s}"
         | 
| 21 | 
            -
                elsif hex
         | 
| 22 | 
            -
                  return "'#{hex}'.uicolor#{alpha_s}"
         | 
| 23 21 | 
             
                elsif css_name
         | 
| 24 22 | 
             
                  return ":#{css_name}.uicolor#{alpha_s}"
         | 
| 23 | 
            +
                elsif hex
         | 
| 24 | 
            +
                  return "'#{hex}'.uicolor#{alpha_s}"
         | 
| 25 25 | 
             
                else
         | 
| 26 26 | 
             
                  super
         | 
| 27 27 | 
             
                end
         | 
    
        data/lib/sugarcube/uicolor.rb
    CHANGED
    
    | @@ -16,13 +16,15 @@ class UIColor | |
| 16 16 | 
             
              # @example
         | 
| 17 17 | 
             
              #     :white.uicolor + :black.uicolor == :gray.uicolor
         | 
| 18 18 | 
             
              def +(color)
         | 
| 19 | 
            -
                mix_with(color, 0.5)
         | 
| 19 | 
            +
                mix_with(color.uicolor, 0.5)
         | 
| 20 20 | 
             
              end
         | 
| 21 21 |  | 
| 22 22 | 
             
              # a more generic color mixing method.  mixes two colors, but a second
         | 
| 23 23 | 
             
              # parameter determines how much of each.  0.5 means equal parts, 0.0 means use
         | 
| 24 24 | 
             
              # all of the first, and 1.0 means use all of the second
         | 
| 25 25 | 
             
              def mix_with(color, amount)
         | 
| 26 | 
            +
                color = color.uicolor
         | 
| 27 | 
            +
             | 
| 26 28 | 
             
                # make amount between 0 and 1
         | 
| 27 29 | 
             
                amount = [[0, amount].max, 1].min
         | 
| 28 30 | 
             
                # start with precise amounts: 0, 0.5, and 1.
         | 
    
        data/lib/sugarcube/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sugarcube
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.20. | 
| 4 | 
            +
              version: 0.20.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -13,7 +13,7 @@ authors: | |
| 13 13 | 
             
            autorequire: 
         | 
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 | 
            -
            date: 2013-03- | 
| 16 | 
            +
            date: 2013-03-22 00:00:00.000000000 Z
         | 
| 17 17 | 
             
            dependencies: []
         | 
| 18 18 | 
             
            description: ! '== Description
         | 
| 19 19 |  |