Class: Belafonte::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/belafonte/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Validator

Returns a new instance of Validator.



5
6
7
8
# File 'lib/belafonte/validator.rb', line 5

def initialize(app)
  @app = app
  @errors = {}
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/belafonte/validator.rb', line 3

def errors
  @errors
end

Instance Method Details

#app_titleObject



18
19
20
# File 'lib/belafonte/validator.rb', line 18

def app_title
  app.info(:title)
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/belafonte/validator.rb', line 10

def valid?
  error_if_app_lacks_title
  error_if_app_has_multiple_unlimited_args
  error_if_app_has_mounts_and_unlimited_args

  errors.empty?
end