Class: HumanPower::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/human_power/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, path) ⇒ Rule

Returns a new instance of Rule.



5
6
7
8
# File 'lib/human_power/rule.rb', line 5

def initialize(type, path)
  @type = type
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/human_power/rule.rb', line 3

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/human_power/rule.rb', line 3

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/human_power/rule.rb', line 16

def ==(other)
  other.type == type && other.path == path
end

#renderObject Also known as: to_s



10
11
12
# File 'lib/human_power/rule.rb', line 10

def render
  "#{type.to_s.capitalize}: #{path}"
end