Class: Orphic::OrphicCli::Cursor

Inherits:
Thor
  • Object
show all
Defined in:
lib/orphic/cli/sprites/cursor.rb

Instance Method Summary collapse

Instance Method Details

#GeekCursor(currentGeek) ⇒ Object



29
30
31
32
33
# File 'lib/orphic/cli/sprites/cursor.rb', line 29

def GeekCursor ( currentGeek )
  CLI::UI::Frame.open( "Cursor :: Geek : " + currentGeek ) do
    puts "#{currentGeek}"
  end
end

#mongoDb(mongoURL) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/orphic/cli/sprites/cursor.rb', line 44

def mongoDb ( mongoURL )
  # mongoDB client setup
  client = Mongo::Client.new( mongoURL )
  collection = client[:people]

  # example doc for testing
  doc = {
    name: 'Steve',
    hobbies: [ 'hiking', 'tennis', 'fly fishing' ],
    siblings: {
      brothers: 0,
      sisters: 1
    }
  }
  if options[:create]
    result = collection.insert_one(doc)
      CLI::UI::Frame.open("Cursor :: MongoDB :: " + mongoURL + ": Create ")
      puts result.n
  end
  if options[:read]
    collection.find.each do |document|
      #=> Yields a BSON::Document.
      CLI::UI::Frame.open( "Cursor :: MongoDB :: " + mongoURL + ": Read ")
      puts document
    end
  end
  if options[:update]
    puts "update put"
  end
  if options[:delete]
    puts "Delete option"
  end
    # implement mongoURL for viewing current info
  CLI::UI::Frame.open( "Cursor :: Mongo :: DB : " + mongoURL ) do
    puts "#{mongoURL}"
  end
end

#posCursor(currentCursor) ⇒ Object



15
16
17
18
19
20
# File 'lib/orphic/cli/sprites/cursor.rb', line 15

def posCursor( currentCursor )
  # implement viewType
  CLI::UI::Frame.open( "Cursor :: Position : " + currentCursor ) do
    puts "#{currentCursor}"
  end
end