Class: WAB::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/wab/shell.rb

Overview

The Shell is a duck-typed class. Any shell alternative should implement all the methods defined in the class except the initialize method. The Shell acts as the conduit between the View and Model portions of the MVC design pattern.

As the View conduit the Shell usually makes calls to the controller. The exception to this control flow direction is when data changes and is pushed out to the view.

As the Model, the Shell must respond to request to update the store using either the CRUD type operations that match the controller.

Note that this class implementes some basic features related to controller management but those features can be implemented in other ways as long as the methods remain the same.

Instance Method Summary collapse

Instance Method Details

#changed(_data) ⇒ Object

Push changed data to the view if it matches one of the subscription filters.

data: Wab::Data to push to the view if subscribed

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/wab/shell.rb', line 51

def changed(_data)
  raise NotImplementedError.new
end

#data(_value = nil, _repair = false) ⇒ Object

Create and return a new data instance with the provided initial value. The value must be a Hash or Array. The members of the Hash or Array must be nil, boolean, String, Integer, Float, BigDecimal, Array, Hash, Time, URI::HTTP, or WAB::UUID. Keys to Hashes must be Symbols.

If the repair flag is true then an attempt will be made to fix the value by replacing String keys with Symbols and calling to_h or to_s on unsupported Objects.

value

initial value

repair

flag indicating invalid value should be repaired if possible

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/wab/shell.rb', line 41

def data(_value=nil, _repair=false)
  raise NotImplementedError.new
end

#error(_message) ⇒ Object

Logs an error with the shell logger.

message

message to log

Raises:

  • (NotImplementedError)


104
105
106
# File 'lib/wab/shell.rb', line 104

def error(_message)
  raise NotImplementedError.new
end

#error?Boolean

Returns true if error logging is turned on.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


87
88
89
# File 'lib/wab/shell.rb', line 87

def error?
  raise NotImplementedError.new
end

#get(_ref) ⇒ Object

Returns a WAB::Data that matches the object reference or nil if there is no match.

ref

object reference

Raises:

  • (NotImplementedError)


61
62
63
# File 'lib/wab/shell.rb', line 61

def get(_ref)
  raise NotImplementedError.new
end

#info(_message) ⇒ Object

Logs an info with the shell logger.

message

message to log

Raises:

  • (NotImplementedError)


118
119
120
# File 'lib/wab/shell.rb', line 118

def info(_message)
  raise NotImplementedError.new
end

#info?Boolean

Returns true if info logging is turned on.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


97
98
99
# File 'lib/wab/shell.rb', line 97

def info?
  raise NotImplementedError.new
end

#path_posObject

Returns the position of the type in a path.

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/wab/shell.rb', line 26

def path_pos()
  raise NotImplementedError.new
end

#query(_tql) ⇒ Object

Evaluates the JSON TQL query. The TQL should be native Ruby objects that correspond to the TQL JSON format but using Symbol keys instead of strings.

tql

query to evaluate

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/wab/shell.rb', line 70

def query(_tql)
  raise NotImplementedError.new
end

#subscribe(_controller, _filter) ⇒ Object

Subscribe to changes in stored data and push changes to the controller if it passes the supplied filter.

The controller#changed method is called when changes in data cause the associated object to pass the provided filter.

controller

the controller to notify of changed

filter

the filter to apply to the data. Syntax is that TQL uses for the FILTER clause.

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/wab/shell.rb', line 82

def subscribe(_controller, _filter)
  raise NotImplementedError.new
end

#type_keyObject

Returns the path where a data type is located. The default is ‘kind’.

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/wab/shell.rb', line 21

def type_key()
  raise NotImplementedError.new
end

#warn(_message) ⇒ Object

Logs a warning with the shell logger.

message

message to log

Raises:

  • (NotImplementedError)


111
112
113
# File 'lib/wab/shell.rb', line 111

def warn(_message)
  raise NotImplementedError.new
end

#warn?Boolean

Returns true if warn logging is turned on.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


92
93
94
# File 'lib/wab/shell.rb', line 92

def warn?
  raise NotImplementedError.new
end