Class: Hyrb::Models::Developer

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrb/models/developer.rb

Constant Summary collapse

ROLE_MAP =
{
  1 => :admin,
  2 => :developer,
  3 => :contractor,
  4 => :banned,
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Developer

Returns a new instance of Developer.



13
14
15
16
17
# File 'lib/hyrb/models/developer.rb', line 13

def initialize(hash = {})
  hash.each do |k,v|
    send("#{k}=", v)
  end
end

Instance Attribute Details

#digital_ocean_idObject

Returns the value of attribute digital_ocean_id.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def digital_ocean_id
  @digital_ocean_id
end

#emailObject

Returns the value of attribute email.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def email
  @email
end

#github_usernameObject

Returns the value of attribute github_username.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def github_username
  @github_username
end

#keysObject

Returns the value of attribute keys.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def keys
  @keys
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def name
  @name
end

#roleObject

Returns the value of attribute role.



11
12
13
# File 'lib/hyrb/models/developer.rb', line 11

def role
  @role
end

Instance Method Details

#employee?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/hyrb/models/developer.rb', line 19

def employee?
  [:admin, :developer].include?(role)
end

#to_hashObject



23
24
25
# File 'lib/hyrb/models/developer.rb', line 23

def to_hash
  Hash[%w(name email role github_username keys).map { |a| [a, send(a)] }]
end