Class: SmartAleck::EntryCreator

Inherits:
Object
  • Object
show all
Includes:
Optionally::Required
Defined in:
lib/smart_aleck/entry_creator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EntryCreator

Returns a new instance of EntryCreator.



14
15
16
17
18
19
20
21
22
23
# File 'lib/smart_aleck/entry_creator.rb', line 14

def initialize(options = {})
  SmartAleck.verify_configured
  check_required_options(options, :title, :content, :categories, :user)
  @title = options[:title]
  @content = options[:content]
  @categories = options[:categories]
  @user = options[:user]
  populate_entry
  categorize_entry
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



8
9
10
# File 'lib/smart_aleck/entry_creator.rb', line 8

def entry
  @entry
end

Class Method Details

.create(options = {}) ⇒ Object



10
11
12
# File 'lib/smart_aleck/entry_creator.rb', line 10

def self.create(options = {})
  new(options).entry
end