Class: JSON::Editor::OptionsMenu
- Inherits:
-
Object
- Object
- JSON::Editor::OptionsMenu
- Includes:
- MenuExtension
- Defined in:
- lib/json/editor.rb
Instance Attribute Summary collapse
-
#pretty_item ⇒ Object
readonly
Returns the value of attribute pretty_item.
Attributes included from MenuExtension
Instance Method Summary collapse
-
#collapsed_nodes(item) ⇒ Object
Collapse/Expand all nodes by default.
-
#create ⇒ Object
Create the menu.
-
#pretty_saving(item) ⇒ Object
Toggle pretty saving mode on/off.
Methods included from MenuExtension
#add_item, #add_separator, #initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JSON::Editor::MenuExtension
Instance Attribute Details
#pretty_item ⇒ Object (readonly)
Returns the value of attribute pretty_item.
625 626 627 |
# File 'lib/json/editor.rb', line 625 def pretty_item @pretty_item end |
Instance Method Details
#collapsed_nodes(item) ⇒ Object
Collapse/Expand all nodes by default.
609 610 611 612 613 614 615 616 617 |
# File 'lib/json/editor.rb', line 609 def collapsed_nodes(item) if self. = false collapse_all else self. = true end end |
#create ⇒ Object
Create the menu.
628 629 630 631 632 633 634 635 636 637 |
# File 'lib/json/editor.rb', line 628 def create title = MenuItem.new('Options') title. = add_item('Collapsed nodes', CheckMenuItem, &method(:collapsed_nodes)) @pretty_item = add_item('Pretty saving', CheckMenuItem, &method(:pretty_saving)) @pretty_item.active = true window.unchange title end |
#pretty_saving(item) ⇒ Object
Toggle pretty saving mode on/off.
620 621 622 623 |
# File 'lib/json/editor.rb', line 620 def pretty_saving(item) @pretty_item.toggled window.change end |