Class: Scryglass::Config
- Inherits:
-
Object
- Object
- Scryglass::Config
- Defined in:
- lib/scryglass/config.rb
Instance Attribute Summary collapse
-
#cursor_tracking ⇒ Object
Returns the value of attribute cursor_tracking.
-
#dot_coloring ⇒ Object
Returns the value of attribute dot_coloring.
-
#include_empty_associations ⇒ Object
Returns the value of attribute include_empty_associations.
-
#include_scoped_associations ⇒ Object
Returns the value of attribute include_scoped_associations.
-
#include_through_associations ⇒ Object
Returns the value of attribute include_through_associations.
-
#lenses ⇒ Object
Returns the value of attribute lenses.
-
#show_association_types ⇒ Object
Returns the value of attribute show_association_types.
-
#tab_length ⇒ Object
Returns the value of attribute tab_length.
-
#tree_view_key_string_clip_length ⇒ Object
Returns the value of attribute tree_view_key_string_clip_length.
-
#tree_view_value_string_clip_length ⇒ Object
Returns the value of attribute tree_view_value_string_clip_length.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/scryglass/config.rb', line 17 def initialize ## Display self.tab_length = 2 # You can make it 0, but please don't make it 0. self.tree_view_key_string_clip_length = 200 self.tree_view_value_string_clip_length = 500 self.dot_coloring = true ## UX self.cursor_tracking = [:flexible_range, :dead_center][0] # One or the other self.lenses = [ # Custom lenses can easily be added as name+lambda hashes! Or comment some out to turn them off. { name: 'Pretty Print (`pp`)', lambda: ->(o) { Hexes.capture_io(char_limit: 20_000) { pp o } } }, { name: 'Amazing Print (`ap`)', lambda: ->(o) { Hexes.capture_io(char_limit: 20_000) { ap o } } }, # This has colors! { name: 'Inspect (`.inspect`)', lambda: ->(o) { Hexes.capture_io(char_limit: 20_000) { puts o.inspect } } }, { name: 'Yaml Print (`y`)', lambda: ->(o) { Hexes.capture_io(char_limit: 20_000) { require 'yaml' ; y o } } }, # OR: `puts o.to_yaml` { name: 'Puts (`puts`)', lambda: ->(o) { Hexes.capture_io(char_limit: 20_000) { puts o } } }, { name: 'Method Showcase', lambda: ->(o) { Scryglass::LensHelper.method_showcase_for(o, char_limit: 20_000) } }, ] ## AmazingPrint defaults, if the user has not set their own: ::AmazingPrint.defaults ||= { index: false, # (Don't display array indices). raw: true, # (Recursively format instance variables). } # See https://github.com/amazing-print/amazing_print ## Building ActiveRecord association sub-rows: self.include_empty_associations = true self.include_through_associations = false self.include_scoped_associations = false self.show_association_types = true end |
Instance Attribute Details
#cursor_tracking ⇒ Object
Returns the value of attribute cursor_tracking.
11 12 13 |
# File 'lib/scryglass/config.rb', line 11 def cursor_tracking @cursor_tracking end |
#dot_coloring ⇒ Object
Returns the value of attribute dot_coloring.
15 16 17 |
# File 'lib/scryglass/config.rb', line 15 def dot_coloring @dot_coloring end |
#include_empty_associations ⇒ Object
Returns the value of attribute include_empty_associations.
8 9 10 |
# File 'lib/scryglass/config.rb', line 8 def include_empty_associations @include_empty_associations end |
#include_scoped_associations ⇒ Object
Returns the value of attribute include_scoped_associations.
8 9 10 |
# File 'lib/scryglass/config.rb', line 8 def include_scoped_associations @include_scoped_associations end |
#include_through_associations ⇒ Object
Returns the value of attribute include_through_associations.
8 9 10 |
# File 'lib/scryglass/config.rb', line 8 def include_through_associations @include_through_associations end |
#lenses ⇒ Object
Returns the value of attribute lenses.
12 13 14 |
# File 'lib/scryglass/config.rb', line 12 def lenses @lenses end |
#show_association_types ⇒ Object
Returns the value of attribute show_association_types.
8 9 10 |
# File 'lib/scryglass/config.rb', line 8 def show_association_types @show_association_types end |
#tab_length ⇒ Object
Returns the value of attribute tab_length.
7 8 9 |
# File 'lib/scryglass/config.rb', line 7 def tab_length @tab_length end |
#tree_view_key_string_clip_length ⇒ Object
Returns the value of attribute tree_view_key_string_clip_length.
13 14 15 |
# File 'lib/scryglass/config.rb', line 13 def tree_view_key_string_clip_length @tree_view_key_string_clip_length end |
#tree_view_value_string_clip_length ⇒ Object
Returns the value of attribute tree_view_value_string_clip_length.
13 14 15 |
# File 'lib/scryglass/config.rb', line 13 def tree_view_value_string_clip_length @tree_view_value_string_clip_length end |
Instance Method Details
#validate! ⇒ Object
55 56 57 58 59 60 |
# File 'lib/scryglass/config.rb', line 55 def validate! validate_boolean_attrs! validate_positive_integer_attrs! validate_lenses! end |