Class: Keynote::Theme

Inherits:
Object
  • Object
show all
Extended by:
Util
Defined in:
lib/keynote/theme.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

eval_script

Constructor Details

#initialize(id: nil, name: nil) ⇒ Theme

Returns a new instance of Theme.



9
10
11
12
# File 'lib/keynote/theme.rb', line 9

def initialize(id: nil, name: nil)
  @id = id
  @name = name
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/keynote/theme.rb', line 7

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/keynote/theme.rb', line 7

def name
  @name
end

Class Method Details

.allObject



18
19
20
# File 'lib/keynote/theme.rb', line 18

def self.all
  self.find_with_conditions
end

.defaultObject



14
15
16
# File 'lib/keynote/theme.rb', line 14

def self.default
  self.all.first
end

.find_by(args) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/keynote/theme.rb', line 22

def self.find_by(args)
  raise ArgumentError.new('nil argument is given') unless args

  if args.is_a?(Hash) && args.has_key?(:name)
    conditions = ".whose({ name: '#{args[:name]}' })"
  else
    raise ArgumentError.new('Unsupported argument is given')
  end

  find_with_conditions(conditions)
end