Class: Appydave::Tools::BrainContextOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/appydave/tools/brain_context/options.rb

Overview

Options struct for brain/OMI query tools

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBrainContextOptions

Returns a new instance of BrainContextOptions.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/appydave/tools/brain_context/options.rb', line 13

def initialize
  @brain_names = []
  @categories = []
  @active = false
  @meta = false

  @omi = false
  @omi_routings = []
  @omi_activities = []
  @date_from = nil
  @date_to = nil
  @enriched_only = true
  @days = nil
  @limit = nil

  @include_index = true
  @output_targets = ['clipboard'] # default to clipboard
  @formats = ['content']
  @line_limit = nil
  @debug_level = 'none'
  @dry_run = false
  @tokens = false
  @base_dir = Dir.pwd

  configured_omi = read_setting('omi-directory-path')
  @omi_dir = configured_omi || File.expand_path('~/dev/raw-intake/omi')
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def active
  @active
end

#base_dirObject

Returns the value of attribute base_dir.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def base_dir
  @base_dir
end

#brain_namesObject

Returns the value of attribute brain_names.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def brain_names
  @brain_names
end

#categoriesObject

Returns the value of attribute categories.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def categories
  @categories
end

#date_fromObject

Returns the value of attribute date_from.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def date_from
  @date_from
end

#date_toObject

Returns the value of attribute date_to.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def date_to
  @date_to
end

#daysObject

Returns the value of attribute days.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def days
  @days
end

#debug_levelObject

Returns the value of attribute debug_level.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def debug_level
  @debug_level
end

#dry_runObject

Returns the value of attribute dry_run.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def dry_run
  @dry_run
end

#enriched_onlyObject

Returns the value of attribute enriched_only.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def enriched_only
  @enriched_only
end

#formatsObject

Returns the value of attribute formats.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def formats
  @formats
end

#include_indexObject

Returns the value of attribute include_index.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def include_index
  @include_index
end

#limitObject

Returns the value of attribute limit.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def limit
  @limit
end

#line_limitObject

Returns the value of attribute line_limit.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def line_limit
  @line_limit
end

#metaObject

Returns the value of attribute meta.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def meta
  @meta
end

#omiObject

Returns the value of attribute omi.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def omi
  @omi
end

#omi_activitiesObject

Returns the value of attribute omi_activities.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def omi_activities
  @omi_activities
end

#omi_dirObject

Returns the value of attribute omi_dir.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def omi_dir
  @omi_dir
end

#omi_routingsObject

Returns the value of attribute omi_routings.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def omi_routings
  @omi_routings
end

#output_targetsObject

Returns the value of attribute output_targets.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def output_targets
  @output_targets
end

#tokensObject

Returns the value of attribute tokens.



7
8
9
# File 'lib/appydave/tools/brain_context/options.rb', line 7

def tokens
  @tokens
end

Instance Method Details

#brain_query?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/appydave/tools/brain_context/options.rb', line 52

def brain_query?
  brain_names.any? || categories.any? || active
end

#brains_index_pathObject



48
49
50
# File 'lib/appydave/tools/brain_context/options.rb', line 48

def brains_index_path
  File.join(brains_root, 'audit', 'brains-index.json')
end

#brains_rootObject



41
42
43
44
45
46
# File 'lib/appydave/tools/brain_context/options.rb', line 41

def brains_root
  @brains_root ||= begin
    configured = read_setting('brains-root-path')
    configured || File.expand_path('~/dev/ad/brains')
  end
end

#omi_query?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/appydave/tools/brain_context/options.rb', line 56

def omi_query?
  omi
end