Class: Lino::Model::Flag

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flag, opts = {}) ⇒ Flag

Returns a new instance of Flag.



9
10
11
12
13
# File 'lib/lino/model/flag.rb', line 9

def initialize(flag, opts = {})
  opts = with_defaults(opts)
  @flag = flag
  @placement = opts[:placement]
end

Instance Attribute Details

#flagObject (readonly)

Returns the value of attribute flag.



6
7
8
# File 'lib/lino/model/flag.rb', line 6

def flag
  @flag
end

#placementObject (readonly)

Returns the value of attribute placement.



6
7
8
# File 'lib/lino/model/flag.rb', line 6

def placement
  @placement
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



25
26
27
28
# File 'lib/lino/model/flag.rb', line 25

def ==(other)
  self.class == other.class &&
    state == other.state
end

#arrayObject



20
21
22
# File 'lib/lino/model/flag.rb', line 20

def array
  [flag.to_s]
end

#hashObject



31
32
33
# File 'lib/lino/model/flag.rb', line 31

def hash
  [self.class, state].hash
end

#stringObject Also known as: to_s, to_a



15
16
17
# File 'lib/lino/model/flag.rb', line 15

def string
  flag.to_s
end