Class: TrelloConfig
- Inherits:
-
Object
- Object
- TrelloConfig
- Defined in:
- lib/totrello/trello_config.rb
Overview
TrelloConfig
Instance Attribute Summary collapse
-
#board_name ⇒ Object
Returns the value of attribute board_name.
-
#comment_style ⇒ Object
Returns the value of attribute comment_style.
-
#default_list ⇒ Object
Returns the value of attribute default_list.
-
#excludes ⇒ Object
Returns the value of attribute excludes.
-
#file_types ⇒ Object
Returns the value of attribute file_types.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#todo_types ⇒ Object
Returns the value of attribute todo_types.
Instance Method Summary collapse
- #default_config(directory = Dir.pwd.to_s) ⇒ Object
-
#initialize(directory = Dir.pwd.to_s) ⇒ TrelloConfig
constructor
A new instance of TrelloConfig.
- #load_config(config_file) ⇒ Object
Constructor Details
#initialize(directory = Dir.pwd.to_s) ⇒ TrelloConfig
Returns a new instance of TrelloConfig.
8 9 10 11 |
# File 'lib/totrello/trello_config.rb', line 8 def initialize(directory = Dir.pwd.to_s) load_config("#{directory}/.totrello.yml") default_config(directory) end |
Instance Attribute Details
#board_name ⇒ Object
Returns the value of attribute board_name.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def board_name @board_name end |
#comment_style ⇒ Object
Returns the value of attribute comment_style.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def comment_style @comment_style end |
#default_list ⇒ Object
Returns the value of attribute default_list.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def default_list @default_list end |
#excludes ⇒ Object
Returns the value of attribute excludes.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def excludes @excludes end |
#file_types ⇒ Object
Returns the value of attribute file_types.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def file_types @file_types end |
#project_name ⇒ Object
Returns the value of attribute project_name.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def project_name @project_name end |
#todo_types ⇒ Object
Returns the value of attribute todo_types.
5 6 7 |
# File 'lib/totrello/trello_config.rb', line 5 def todo_types @todo_types end |
Instance Method Details
#default_config(directory = Dir.pwd.to_s) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/totrello/trello_config.rb', line 13 def default_config(directory = Dir.pwd.to_s) @project_name ||= directory.split('/').last @board_name ||= directory.split('/').last @default_list ||= 'To Do' @excludes ||= Array(nil) @todo_types ||= Array(['TODO', '#TODO', '#TODO:', 'TODO:']) @file_types ||= Array(['.rb', '.erb']) @comment_style ||= Array(['#']) end |
#load_config(config_file) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/totrello/trello_config.rb', line 23 def load_config(config_file) return if config_file == '' config_yaml = YAML.load_file(config_file) config_yaml['totrello'].each do |key, value| instance_variable_set("@#{key}", value) end end |