Class: SocialSnippet::Snippet

Inherits:
Object
  • Object
show all
Defined in:
lib/social_snippet/snippet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snippet_path) ⇒ Snippet

Constructor


8
9
10
11
12
# File 'lib/social_snippet/snippet.rb', line 8

def initialize(snippet_path)
  @path = snippet_path
  @code = ::File.read(@path)
  @lines = @code.split("\n")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code


4
5
6
# File 'lib/social_snippet/snippet.rb', line 4

def code
  @code
end

#linesObject (readonly)

Returns the value of attribute lines


5
6
7
# File 'lib/social_snippet/snippet.rb', line 5

def lines
  @lines
end

#pathObject (readonly)

Returns the value of attribute path


3
4
5
# File 'lib/social_snippet/snippet.rb', line 3

def path
  @path
end