Class: Spoom::Model::Visibility

Inherits:
Object
  • Object
show all
Defined in:
lib/spoom/model/model.rb

Constant Summary collapse

Public =

: Visibility

new("public")
Protected =

: Visibility

new("protected")
Private =

: Visibility

new("private")

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Visibility

: (String) -> void



210
211
212
# File 'lib/spoom/model/model.rb', line 210

def initialize(name)
  @name = name
end

Class Method Details

.from_string(name) ⇒ Object

: (String) -> Visibility



198
199
200
201
202
203
204
205
206
# File 'lib/spoom/model/model.rb', line 198

def from_string(name)
  case name
  when "public" then Public
  when "protected" then Protected
  when "private" then Private
  else
    raise Error, "Invalid visibility: #{name}"
  end
end

Instance Method Details

#to_s ⇒ Object

: -> String



216
217
218
# File 'lib/spoom/model/model.rb', line 216

def to_s
  @name
end