Class: Blocklist::Block
- Inherits:
-
Object
- Object
- Blocklist::Block
- Defined in:
- lib/blocklist.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name = nil, *lines) ⇒ Block
constructor
A new instance of Block.
- #to_s ⇒ Object
- #toggle_comments ⇒ Object
Constructor Details
#initialize(name = nil, *lines) ⇒ Block
Returns a new instance of Block.
41 42 43 44 |
# File 'lib/blocklist.rb', line 41 def initialize(name=nil, *lines) self.name = name self.lines = lines end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
39 40 41 |
# File 'lib/blocklist.rb', line 39 def lines @lines end |
#name ⇒ Object
Returns the value of attribute name.
39 40 41 |
# File 'lib/blocklist.rb', line 39 def name @name end |
Instance Method Details
#==(other) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/blocklist.rb', line 46 def ==(other) return false unless other.class == self.class return false unless other.name == self.name return false unless other.lines == self.lines true end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/blocklist.rb', line 57 def to_s "# #{name}\n" + lines.join("\n") end |
#toggle_comments ⇒ Object
53 54 55 |
# File 'lib/blocklist.rb', line 53 def toggle_comments lines.each {|line| line.toggle_comment} end |