Class: OsCtld::PrLimits::PrLimit

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/prlimits/prlimit.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, soft, hard) ⇒ PrLimit

Returns a new instance of PrLimit.



10
11
12
13
14
# File 'lib/osctld/prlimits/prlimit.rb', line 10

def initialize(name, soft, hard)
  @name = name
  @soft = soft
  @hard = hard
end

Instance Attribute Details

#hardObject (readonly)

Returns the value of attribute hard.



3
4
5
# File 'lib/osctld/prlimits/prlimit.rb', line 3

def hard
  @hard
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/osctld/prlimits/prlimit.rb', line 3

def name
  @name
end

#softObject (readonly)

Returns the value of attribute soft.



3
4
5
# File 'lib/osctld/prlimits/prlimit.rb', line 3

def soft
  @soft
end

Class Method Details

.load(name, cfg) ⇒ Object

Load from config



6
7
8
# File 'lib/osctld/prlimits/prlimit.rb', line 6

def self.load(name, cfg)
  new(name, cfg['soft'], cfg['hard'])
end

Instance Method Details

#dumpObject

Dump to config



27
28
29
# File 'lib/osctld/prlimits/prlimit.rb', line 27

def dump
  { 'soft' => soft, 'hard' => hard }
end

#exportObject

Export to client



22
23
24
# File 'lib/osctld/prlimits/prlimit.rb', line 22

def export
  { soft:, hard: }
end

#set(soft, hard) ⇒ Object



16
17
18
19
# File 'lib/osctld/prlimits/prlimit.rb', line 16

def set(soft, hard)
  @soft = soft
  @hard = hard
end